Class: ODDB::LppvPlugin::PriceUpdate

Inherits:
Object
  • Object
show all
Defined in:
src/plugin/lppv.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (PriceUpdate) initialize(package, current)

A new instance of PriceUpdate



46
47
48
49
50
51
52
53
54
55
# File 'src/plugin/lppv.rb', line 46

def initialize(package, current)
  old = package.price_public
  if old == nil
    @old = Package.price_internal(0)
  else
    @old = old
  end
  @current = Package.price_internal(current, :public)
  @package = package
end

Instance Attribute Details

- (Object) current (readonly)

Returns the value of attribute current



45
46
47
# File 'src/plugin/lppv.rb', line 45

def current
  @current
end

- (Object) old (readonly)

Returns the value of attribute old



45
46
47
# File 'src/plugin/lppv.rb', line 45

def old
  @old
end

- (Object) package (readonly)

Returns the value of attribute package



45
46
47
# File 'src/plugin/lppv.rb', line 45

def package
  @package
end

Instance Method Details

- (Boolean) changed?

Returns:

  • (Boolean)


62
63
64
# File 'src/plugin/lppv.rb', line 62

def changed?
  @current != @old
end

- (Boolean) down?

Returns:

  • (Boolean)


59
60
61
# File 'src/plugin/lppv.rb', line 59

def down?
  @current < @old
end

- (Object) report_lines



69
70
71
72
73
74
75
76
# File 'src/plugin/lppv.rb', line 69

def report_lines
  [
    resolve_link(package),
    sprintf("%-20s  %-20.2f  %-20.2f %s", @package.iksnr, 
            @old.to_f, @current.to_f, @package.name),
            nil,
  ]
end


65
66
67
68
# File 'src/plugin/lppv.rb', line 65

def resolve_link(model)
  pointer = model.pointer
  str = 'http://ch.oddb.org/de/gcc/resolve/pointer/'.concat(CGI.escape(pointer.to_s))
end

- (Boolean) up?

Returns:

  • (Boolean)


56
57
58
# File 'src/plugin/lppv.rb', line 56

def up?
  @current > @old
end