class Measurb::DimensionBuilder::ValueProxy

Placeholder class in definition blocks for writing straightforward conversion syntax. Currently only supports multiplication and division.

Examples

Measurb.define :inches do
  feet value / 12.0
end

Measurb.define :feet do
  inches value * 12.0
end

Public Instance Methods

*(convert_value) click to toggle source

Handle a conversion by multiplication

@param convert_value [Float] @return [Proc] Proc to be used as the body for the conversion method on the {Dimension dimension class}

# File lib/measurb/dimension_builder.rb, line 95
def *(convert_value)
  proc { value * convert_value }
end
/(convert_value) click to toggle source

Handle a conversion by division

@param convert_value [Float] @return [Proc] Proc to be used as the body for the conversion method on the {Dimension dimension class}

# File lib/measurb/dimension_builder.rb, line 103
def /(convert_value)
  proc { value / convert_value }
end