class SimpleUnits::Context
Attributes
inspector[RW]
name[RW]
type[RW]
Public Class Methods
define_unit(name, &block)
click to toggle source
# File lib/simple_units/context.rb, line 5 def define_unit(name, &block) @contexts ||= {} @contexts[name.to_s] = new(name, &block) end
get_context(name)
click to toggle source
# File lib/simple_units/context.rb, line 10 def get_context(name) throw :UndefinedUnitError if @contexts[name].nil? @contexts[name.to_s] end
new(name=nil) { |self| ... }
click to toggle source
# File lib/simple_units/context.rb, line 17 def initialize(name=nil, &block) @name = name yield(self) end