Class: Issola::Command::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/issola/command/builder.rb

Instance Method Summary collapse

Instance Method Details

#action(&blk) ⇒ Object



8
9
10
# File 'lib/issola/command/builder.rb', line 8

def action(&blk)
  @action = blk
end

#commandObject

Raises:

  • (ArgumentError)


12
13
14
15
16
# File 'lib/issola/command/builder.rb', line 12

def command
  raise ArgumentError, 'Unable to build command, missing attributes' unless valid?

  Command.new(key: @key, action: @action)
end

#key(key) ⇒ Object



4
5
6
# File 'lib/issola/command/builder.rb', line 4

def key(key)
  @key = key.to_s
end

#valid?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/issola/command/builder.rb', line 18

def valid?
  @key && @action
end