Class: Autodeps::ReactiveData

Inherits:
Object
  • Object
show all
Defined in:
lib/autodeps/reactive_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ReactiveData

Returns a new instance of ReactiveData.



4
5
6
7
# File 'lib/autodeps/reactive_data.rb', line 4

def initialize(value)
  @value = value
  @dep = Autodeps::Dependency.new
end

Instance Attribute Details

#depObject

Returns the value of attribute dep.



3
4
5
# File 'lib/autodeps/reactive_data.rb', line 3

def dep
  @dep
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/autodeps/reactive_data.rb', line 3

def value
  @value
end

Instance Method Details

#change_to(value) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/autodeps/reactive_data.rb', line 8

def change_to(value)
  if value != @value
    changed = true
  end
  @value = value
  if changed
    @dep.changed
  end
end