Class: AttrFile
- Inherits:
-
Object
- Object
- AttrFile
- Defined in:
- lib/active_csv/attr_file.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #fields(model_name) ⇒ Object
-
#initialize(_name) ⇒ AttrFile
constructor
A new instance of AttrFile.
Constructor Details
#initialize(_name) ⇒ AttrFile
Returns a new instance of AttrFile.
4 5 6 |
# File 'lib/active_csv/attr_file.rb', line 4 def initialize(_name) @name = _name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/active_csv/attr_file.rb', line 2 def name @name end |
Instance Method Details
#fields(model_name) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/active_csv/attr_file.rb', line 7 def fields(model_name) # The sequency of the attributes is always the same as in the yaml file. model_fields = YAML.load_file(@name) fields = model_fields[model_name].split(', ').insert(0,"id") #Array fields end |