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 Delegation::DelegateCache
#inherited, #initialize_relation_delegate_cache, #relation_delegate_class
Methods included from Reflection
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.
56 57 58 |
# File 'lib/active_any/base.rb', line 56 def file @file end |
Class Method Details
.adapter ⇒ Object
78 79 80 |
# File 'lib/active_any/base.rb', line 78 def adapter @adapter ||= ObjectAdapter.new(self) end |
.data ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/active_any/base.rb', line 64 def data @data ||= begin raise MissingFileError unless file table = ::CSV.table(file) table.map { |row| new(row.to_h) } end end |
.reload ⇒ Object
73 74 75 76 |
# File 'lib/active_any/base.rb', line 73 def reload @data = nil data end |