Class: MyFirstGemHello::Hello
- Inherits:
-
Object
- Object
- MyFirstGemHello::Hello
- Defined in:
- lib/my_first_gem_hello/hello.rb
Instance Method Summary collapse
- #add_item(title = nil, description = nil) ⇒ Object
- #hello ⇒ Object
-
#initialize(name) ⇒ Hello
constructor
A new instance of Hello.
- #show ⇒ Object
Constructor Details
#initialize(name) ⇒ Hello
3 4 5 6 |
# File 'lib/my_first_gem_hello/hello.rb', line 3 def initialize(name) @name = name @items = [] end |
Instance Method Details
#add_item(title = nil, description = nil) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/my_first_gem_hello/hello.rb', line 12 def add_item(title = nil, description = nil) unless [title, description].include?(nil) @items << [title, description] else 'Params nil!' end end |
#hello ⇒ Object
8 9 10 |
# File 'lib/my_first_gem_hello/hello.rb', line 8 def hello "Hello #{@name}" end |
#show ⇒ Object
21 22 23 |
# File 'lib/my_first_gem_hello/hello.rb', line 21 def show @items end |