Class: MyFirstGemHello::Hello

Inherits:
Object
  • Object
show all
Defined in:
lib/my_first_gem_hello/hello.rb

Instance Method Summary collapse

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

#helloObject



8
9
10
# File 'lib/my_first_gem_hello/hello.rb', line 8

def hello
  "Hello #{@name}"
end

#showObject



21
22
23
# File 'lib/my_first_gem_hello/hello.rb', line 21

def show
  @items
end