Class: XPain::OptionsEnhancer

Inherits:
Object
  • Object
show all
Defined in:
lib/xpain/options_enhancer.rb

Constant Summary collapse

ENH_MAP =
{
  :min => :minOccurs,
  :max => :maxOccurs
}

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ OptionsEnhancer

Returns a new instance of OptionsEnhancer.



8
9
10
# File 'lib/xpain/options_enhancer.rb', line 8

def initialize(opts = {})
  @opts = opts
end

Instance Method Details

#enhanceObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/xpain/options_enhancer.rb', line 12

def enhance
  ENH_MAP.each do |matcher, replacement|
    if @opts[matcher]
      value = @opts.delete(matcher)
      @opts[replacement] = value
    end
  end

  @opts
end