Class: ActiveAny::CSV
Defined Under Namespace
Classes: MissingFileError
Class Attribute Summary collapse
-
.file ⇒ Object
Returns the value of attribute file.
Class Method Summary collapse
Methods included from Reflection
_reflect_on_association, add_reflection, create
Methods included from AttributeAssignment
#assign_attributes, #init_internals
Methods included from Associations
Methods included from Attribute
#attribute_for_inspect, #attributes, #has_attribute?, #inspect, #read_attribute
Methods included from Core
Class Attribute Details
.file ⇒ Object
Returns the value of attribute file.
58 59 60 |
# File 'lib/active_any/base.rb', line 58 def file @file end |
Class Method Details
.adapter ⇒ Object
80 81 82 |
# File 'lib/active_any/base.rb', line 80 def adapter @adapter ||= ObjectAdapter.new(self) end |
.data ⇒ Object
66 67 68 69 70 71 72 73 |
# File 'lib/active_any/base.rb', line 66 def data @data ||= begin raise MissingFileError unless file table = ::CSV.table(file) table.map { |row| new(row.to_h) } end end |
.reload ⇒ Object
75 76 77 78 |
# File 'lib/active_any/base.rb', line 75 def reload @data = nil data end |