Class: Lolita::Configuration::Fields

Inherits:
Object
  • Object
show all
Includes:
Enumerable, ObservedArray
Defined in:
lib/lolita/configuration/fields.rb

Overview

Lolita::Configuration::Tabs is container class that holds all tabs for each lolita instance. Also it has some useful methods.

Instance Method Summary collapse

Methods included from ObservedArray

#<<, #[]=, #each, #insert, #method_missing, #push

Constructor Details

#initialize(*args, &block) ⇒ Fields

Returns a new instance of Fields.



11
12
13
14
# File 'lib/lolita/configuration/fields.rb', line 11

def initialize *args,&block
  @fields=[]
  self.instance_eval(&block) if block_given?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Lolita::ObservedArray

Instance Method Details

#by_name(name) ⇒ Object



20
21
22
# File 'lib/lolita/configuration/fields.rb', line 20

def by_name(name)
  @fields.detect{|field| (field.name==name.to_sym || field.name=="#{name}_id".to_sym) }
end

#clearObject



16
17
18
# File 'lib/lolita/configuration/fields.rb', line 16

def clear
  @fields.clear
end