Module: MyChart::Type
- Extended by:
- Enumerable
- Defined in:
- lib/my_chart/type.rb
Class Method Summary collapse
- .concrete(type) ⇒ Object
- .each(&blk) ⇒ Object
- .each_sym(&blk) ⇒ Object
- .load_concrete_charts ⇒ Object
Class Method Details
.concrete(type) ⇒ Object
10 11 12 13 14 |
# File 'lib/my_chart/type.rb', line 10 def concrete type chart_class = detect{|klass| class_to_sym(klass) == type } raise Exception, "no such chart: #{type}" unless chart_class chart_class end |
.each(&blk) ⇒ Object
16 17 18 19 |
# File 'lib/my_chart/type.rb', line 16 def each &blk load_concrete_charts custom_charts.each &blk end |
.each_sym(&blk) ⇒ Object
21 22 23 |
# File 'lib/my_chart/type.rb', line 21 def each_sym &blk map{ |klass| class_to_sym klass }.each &blk end |
.load_concrete_charts ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/my_chart/type.rb', line 25 def load_concrete_charts return if @loaded definitions.each do |c| class_eval File.read(c) end @loaded = true end |