Class: Funk::InputFn

Inherits:
Fn
  • Object
show all
Defined in:
lib/funk/input_fn.rb

Constant Summary

Constants inherited from Fn

Fn::REQUIRED_PARAM_TYPES

Instance Attribute Summary

Attributes inherited from Fn

#dependencies, #name

Instance Method Summary collapse

Constructor Details

#initialize(name, _ = nil) ⇒ InputFn

Returns a new instance of InputFn.



12
13
14
15
# File 'lib/funk/input_fn.rb', line 12

def initialize(name, _=nil)
  @name = name
  @dependencies = []
end

Instance Method Details

#call(input) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/funk/input_fn.rb', line 17

def call(input)
  if input.has_key?(name)
    input[name]
  else
    NO_INPUT_PROVIDED
  end
end