File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2222- Rubocop expected syntax downgraded from ruby 2.6 to 2.5
2323- ` assertEqual() ` and ` assertNotEqual() ` use actual ` == ` and ` != ` -- they no longer require a type to be totally ordered just to do equality tests
2424- Evaluative assertions (is true/false/null/etc) now produce simpler error messages instead of masquerading as an operation (e.g. "== true")
25+ - ` LibraryProperties.to_h ` now properly uses formatters and symbolic keys, in order to support a ` .to_s `
2526
2627### Deprecated
2728
Original file line number Diff line number Diff line change @@ -24,7 +24,12 @@ def initialize(path)
2424
2525 # @return [Hash] the properties as a hash, all strings
2626 def to_h
27- @fields . clone
27+ Hash [ @fields . map { |k , v | [ k . to_sym , send ( k ) ] } ]
28+ end
29+
30+ # @return [String] the string representation
31+ def to_s
32+ to_h . to_s
2833 end
2934
3035 # Enable a shortcut syntax for library property accessors, in the style of `attr_accessor` metaprogramming.
Original file line number Diff line number Diff line change 4646 it "doesn't crash on nonexistent fields" do
4747 expect ( library_properties . dot_a_linkage ) . to be ( nil )
4848 end
49+
50+ it "converts to hash" do
51+ h = library_properties . to_h
52+ expect ( h [ :name ] . class ) . to eq ( String )
53+ expect ( h [ :name ] ) . to eq ( "WebServer" )
54+ expect ( h [ :architectures ] . class ) . to eq ( Array )
55+ expect ( h [ :architectures ] ) . to contain_exactly ( "avr" )
56+ end
4957 end
5058
5159 context "Input handling" do
6573 end
6674 end
6775
68-
6976end
You can’t perform that action at this time.
0 commit comments