Skip to content

Commit

Permalink
Merge pull request #9 from davidrunger/rename-shape-descriptor-to-to_s
Browse files Browse the repository at this point in the history
Rename Shaped::Shape#descriptor methods to #to_s
  • Loading branch information
davidrunger authored Jun 16, 2020
2 parents fee13e9 + fe4506c commit f3f0907
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased
### Changed
- Rename `Shaped::Array#descriptor` and `Shaped::Hash#descriptor` methods to `#to_s`

## 0.2.0 - 2020-06-16
### Added
- Add `Shaped::Array` method and class
Expand Down
2 changes: 1 addition & 1 deletion lib/shaped/array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def initialize(shape_description)
@match_failure_reasons = {}
end

def descriptor
def to_s
"Array shaped like [#{@shape_klass}]"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/shaped/expected_class_descriptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Shaped::ExpectedClassDescriptions

def expected_class_descriptor(expected_klass)
if expected_klass.is_a?(Shaped::Shape)
expected_klass.descriptor
expected_klass.to_s
else
expected_klass.name
end
Expand Down
2 changes: 1 addition & 1 deletion lib/shaped/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(shape_description)
@match_failure_reasons = {}
end

def descriptor
def to_s
printable_shape_description =
@shape_description.map do |key, value|
"#{key.inspect} => #{expected_class_descriptor(value)}"
Expand Down

0 comments on commit f3f0907

Please sign in to comment.