Class: Mobx::Computed

Inherits:
Object
  • Object
show all
Defined in:
lib/mobx/computed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Computed

Returns a new instance of Computed.



5
6
7
# File 'lib/mobx/computed.rb', line 5

def initialize(block)
  @disposer = Mobx.autorun { @value = block.call }
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/mobx/computed.rb', line 3

def value
  @value
end