Class: Knockout::Computed
- Inherits:
-
Object
- Object
- Knockout::Computed
- Defined in:
- lib/opal/knockout/computed.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ Computed
constructor
A new instance of Computed.
- #to_n ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(&block) ⇒ Computed
Returns a new instance of Computed.
3 4 5 6 7 8 9 |
# File 'lib/opal/knockout/computed.rb', line 3 def initialize(&block) @callback = %x{ ko.computed(function() { return #{block.call}; }); } end |
Instance Method Details
#to_n ⇒ Object
15 16 17 |
# File 'lib/opal/knockout/computed.rb', line 15 def to_n @callback end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/opal/knockout/computed.rb', line 11 def to_s @callback.call end |