Module: DailyRep::Changable

Included in:
Entities::Micex, Entities::Minfin, Entities::Yanoil
Defined in:
lib/dailyrep/Changable.rb

Instance Method Summary collapse

Instance Method Details

#track_change(value, delta) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dailyrep/Changable.rb', line 3

def track_change value, delta
  value = value.to_f
  delta = delta.to_f
  push = 0
  if value.abs > delta then
    a_r_out = self.check_history_notif(self.entity.to_s, :delta.to_s)
    if a_r_out.nil? then
      push = 1
    else
      if (a_r_out.to_f - value).abs > delta.to_i then
        push = 1
      end
    end
  end
  return push
end