Last active
April 13, 2018 17:10
-
-
Save havenwood/adbdcdc573fb77400a59a69afde09202 to your computer and use it in GitHub Desktop.
Example for ElDoggo on #ruby IRC
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 ElDogga | |
attr_accessor :some_attribute | |
def initialize | |
yield self | |
end | |
end | |
ElDogga.new do |config| | |
config.some_attribute = 42 | |
end |
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 ElDoggo | |
attr_reader :some_attribute | |
def initialize &block | |
instance_eval &block | |
end | |
def some_attribute value | |
@some_attribute = value | |
end | |
end | |
ElDoggo.new do | |
some_attribute 42 | |
end |
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 ElDoggu | |
attr_reader :some_attribute | |
def initialize | |
yield self | |
end | |
def some_attribute value | |
@some_attribute = value | |
end | |
end | |
ElDoggu.new do |config| | |
config.some_attribute 42 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment