Module: Formic::Helper
- Defined in:
- lib/formic/helper.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.formic_helper(*names) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/formic/helper.rb', line 5 def self.formic_helper *names names.each do |name| define_method(name) { |*args, &block| name = :menu if name == :menu_bar klass = get_class(name) object = klass.new(self, *args, &block) return object } end end |
Instance Method Details
#get_class(symbol) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/formic/helper.rb', line 31 def get_class symbol classname = '' elements = symbol.to_s.split('_') elements.each do |element| classname += element.capitalize end return "Formic::#{classname}".constantize end |