Class: Xbrlware::ValueMapping

Inherits:
Object
  • Object
show all
Defined in:
lib/xbrlware-extras/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeValueMapping

Returns a new instance of ValueMapping.



6
7
8
9
10
11
12
# File 'lib/xbrlware-extras/item.rb', line 6

def initialize
  @unknown_classifier = nil

  @policy = { :credit  => :no_action,
              :debit   => :no_action,
              :unknown => :no_action } # FIXME: a classifier could be used here....
end

Instance Attribute Details

#policyObject

Returns the value of attribute policy.



4
5
6
# File 'lib/xbrlware-extras/item.rb', line 4

def policy
  @policy
end

Instance Method Details

#value(name, defn, val) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/xbrlware-extras/item.rb', line 14

def value(name, defn, val)
  # we ignore 'name' in this implementation

  case @policy[defn]
    when :no_action then val
    when :flip then -val
  end
end