Created
January 9, 2020 00:35
-
-
Save sugamasao/2535e25c6ad4ccfd8575913696a2d780 to your computer and use it in GitHub Desktop.
attr_reader
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 Foo | |
attr_reader :bar | |
def initialize(bar) | |
@bar = bar | |
end | |
def hoge | |
puts "bar is #{bar}" | |
end | |
end | |
foo = Foo.new('hello') | |
foo.hoge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment