Skip to content

Instantly share code, notes, and snippets.

@benjaminoakes
Last active December 1, 2016 18:25
Show Gist options
  • Save benjaminoakes/0653983106809c6b9a334452362a9de7 to your computer and use it in GitHub Desktop.
Save benjaminoakes/0653983106809c6b9a334452362a9de7 to your computer and use it in GitHub Desktop.
class MyClass
def foo
@foo
end
def initialize(foo)
@foo = foo
end
def bar
'bar'
end
def baz
'baz'
end
def thud
'thud'
end
def garply
'garply'
end
def full_name
# str = "#{foo}"
str = foo.to_s
str << " #{bar}" if baz.nil? || (!baz.nil? && baz.include?('blarp'))
str << " #{thud}"
str << " - #{garply}" unless garply.nil?
str
end
end
my_class = MyClass.new('foo')
puts my_class.full_name
puts my_class.full_name
puts my_class.full_name
puts my_class.full_name
puts my_class.foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment