Skip to content

Commit d0235b4

Browse files
committed
Add to_h and to_s for ci_config.rb
1 parent 4f6fc10 commit d0235b4

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77
## [Unreleased]
88
### Added
99
- Provide an `itoa` function. It is present in Arduino's runtime environment but not on most (all?) host systems because itoa is not a portable standard function.
10+
- `to_h` and `to_s` functions for `ci_config.rb`
1011

1112
### Changed
1213
- Simplified the use of `Array.each` with a return statement; it's now simply `Array.find`

lib/arduino_ci/ci_config.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ def initialize
7272
@unittest_info = {}
7373
end
7474

75+
# @return [Hash] config data as a hash
76+
def to_h
77+
{
78+
packages: @package_info,
79+
platforms: @platform_info,
80+
compile: @compile_info,
81+
unittest: @unittest_info
82+
}
83+
end
84+
85+
# @return [String] config data as a string
86+
def to_s
87+
to_h.to_s
88+
end
89+
7590
# Deep-clone a hash
7691
# @param hash [Hash] the source data
7792
# @return [Hash] a copy

0 commit comments

Comments
 (0)