Module: Units::UseBlocks

Included in:
Units
Defined in:
lib/units-system.rb

Overview

This must be included in any module or class from which units expressions are to be used in units or u blocks. It is not needed in Ruby 1.9.1 due to they way constant look-up is done in that version, but Ruby 1.9.2 has changed that an requires this again.

Class Method Summary collapse

Class Method Details

.append_features(target) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/units-system.rb', line 16

def self.append_features(target)
  def target.const_missing(name)
    begin
      Units.Measure(name)
    rescue ArgumentError
      super
    end
  end
end