class AdjustmentBureau::Adjuster

Attributes

amount[RW]
properties[RW]
type[RW]

Public Class Methods

new(adjustable_properties_list, type, amount) click to toggle source
# File lib/adjustment_bureau/adjuster.rb, line 7
def initialize(adjustable_properties_list, type, amount)
  @properties = adjustable_properties_list.map &:to_s
  @type = type
  @amount = amount
end

Public Instance Methods

adjust(property_string) click to toggle source
# File lib/adjustment_bureau/adjuster.rb, line 13
def adjust(property_string)
  property = Property.parse(property_string)
  property.adjust(type, amount) if adjustable? property
  property
end

Private Instance Methods

adjustable?(property) click to toggle source
# File lib/adjustment_bureau/adjuster.rb, line 21
def adjustable?(property)
  @properties.include? property.name
end