Created
February 26, 2013 20:49
-
-
Save joshskeen/5042046 to your computer and use it in GitHub Desktop.
Keyword arguments test!
This file contains 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 TestFoo | |
def initialize(foo: nil, baz: nil, is_awesome: nil, this_ones_required: nil) | |
@foo = foo | |
@baz = baz | |
@is_awesome = is_awesome | |
@this_ones_required = this_ones_required or raise ArgumentError.new("this ones required!") | |
end | |
def to_s | |
"foo: #{@foo}, baz: #{@baz}, is_awesome: #{@is_awesome.to_s}, this_ones_required: #{@this_ones_required}" | |
end | |
end | |
test = TestFoo.new(this_ones_required: true, baz: "QAZ!!", is_awesome: true, foo: "howdy yall") | |
puts test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment