Class: TinyFRP::Node
- Inherits:
-
Object
- Object
- TinyFRP::Node
- Defined in:
- lib/tiny_frp.rb
Instance Attribute Summary collapse
-
#fixed_argc ⇒ Object
readonly
Returns the value of attribute fixed_argc.
Instance Method Summary collapse
Instance Attribute Details
#fixed_argc ⇒ Object (readonly)
Returns the value of attribute fixed_argc.
66 67 68 |
# File 'lib/tiny_frp.rb', line 66 def fixed_argc @fixed_argc end |
Instance Method Details
#>>(node) ⇒ Object
68 69 70 |
# File 'lib/tiny_frp.rb', line 68 def >>(node) node.apply([self]) end |
#apply(args) ⇒ Object
72 73 74 75 76 77 78 79 80 81 |
# File 'lib/tiny_frp.rb', line 72 def apply(args) signals = args.map{|s| s.is_a?(Node) && s.fixed_argc == 0 ? Signal.new(s, []) : s} if signals.any?{|s| !s.is_a?(Signal)} raise "Error: cannot apply SignalFunction to Non-Signal Object." end if signals.size < @fixed_argc || (!@rest_arg && signals.size != @fixed_argc) raise "Error: cannot apply SignalFunction to Signals." end Signal.new(self, signals) end |