Class: Fit4Ruby::GlobalFitDictList
- Inherits:
-
Object
- Object
- Fit4Ruby::GlobalFitDictList
- Defined in:
- lib/fit4ruby/GlobalFitDictList.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #dict(name) ⇒ Object
- #entry(number, name) ⇒ Object
-
#initialize(&block) ⇒ GlobalFitDictList
constructor
A new instance of GlobalFitDictList.
Constructor Details
#initialize(&block) ⇒ GlobalFitDictList
Returns a new instance of GlobalFitDictList.
42 43 44 45 46 |
# File 'lib/fit4ruby/GlobalFitDictList.rb', line 42 def initialize(&block) @current_dict = nil @dicts = {} instance_eval(&block) if block_given? end |
Instance Method Details
#[](name) ⇒ Object
62 63 64 |
# File 'lib/fit4ruby/GlobalFitDictList.rb', line 62 def [](name) @dicts[name] end |
#dict(name) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/fit4ruby/GlobalFitDictList.rb', line 48 def dict(name) if @dicts.include?(name) Log.fatal "Dictionary #{name} has already been defined" end @dicts[name] = @current_dict = GlobalFitDict.new end |
#entry(number, name) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/fit4ruby/GlobalFitDictList.rb', line 55 def entry(number, name) unless @current_dict Log.fatal "You must define a dictionary first" end @current_dict.entry(number, name) end |