Class: Firuta::Commands::Base
- Inherits:
-
Object
- Object
- Firuta::Commands::Base
show all
- Defined in:
- lib/firuta/commands/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(function, params = nil) ⇒ Base
Returns a new instance of Base.
6
7
8
9
|
# File 'lib/firuta/commands/base.rb', line 6
def initialize(function, params = nil)
@proc = function
@params = [params].flatten.compact
end
|
Class Method Details
.terminal? ⇒ Boolean
20
21
22
|
# File 'lib/firuta/commands/base.rb', line 20
def self.terminal?
false
end
|
Instance Method Details
#apply_to(*_params) ⇒ Object
#call(element) ⇒ Object
11
12
13
14
|
# File 'lib/firuta/commands/base.rb', line 11
def call(element)
return @proc.call(element) if @params.empty?
@proc.call(element, *@params)
end
|