Created
February 24, 2015 17:44
-
-
Save denisdefreyne/e5f2ead27d2cc463c7dc to your computer and use it in GitHub Desktop.
Arrays?!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stuff | |
def initialize(params = {}) | |
@foo_name = params.fetch(:foo_name) | |
@foo_identifier = params.fetch(:foo_identifier) | |
@bar_name = params.fetch(:bar_name), | |
@bar_identifier = params.fetch(:bar_identifier) | |
end | |
def to_a | |
[ | |
@foo_name, | |
@foo_identifier, | |
@bar_name, | |
@bar_identifier, | |
] | |
end | |
end | |
p Stuff.new(foo_name: 'The Foo', foo_identifier: '/foo', bar_name: 'The Bar', bar_identifier: '/bar') | |
# #<Stuff:0x007fe343848068 @foo_name="The Foo", @foo_permalink="/foo", @bar_permalink="/bar", @bar_name=["The Bar", "/bar"]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why is
bar_name
an array?!