Module: CsvRowModel::Model
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveWarnings, Concerns::InheritedClassVar, Children, Columns, DynamicColumns, Validators::ValidateAttributes
- Defined in:
- lib/csv_row_model/model.rb,
lib/csv_row_model/model/columns.rb,
lib/csv_row_model/model/children.rb,
lib/csv_row_model/model/comparison.rb,
lib/csv_row_model/model/file_model.rb,
lib/csv_row_model/model/dynamic_columns.rb,
lib/csv_row_model/model/csv_string_model.rb
Overview
Base module for representing a RowModel---a model that represents row(s).
Defined Under Namespace
Modules: Children, Columns, Comparison, DynamicColumns, FileModel Classes: CsvStringModel
Constant Summary
Constants included from DynamicColumns
DynamicColumns::VALID_OPTIONS_KEYS
Constants included from Columns
Instance Attribute Summary collapse
-
#initialized_at ⇒ DateTime
readonly
Return when self has been intialized.
-
#parent ⇒ Model
readonly
Return the parent, if this instance is a child.
Class Method Summary collapse
-
.csv_string_model(&block) ⇒ Object
protected
Called to add validations to the csv_string_model_class.
-
.csv_string_model_class ⇒ Class
The Class with validations of the csv_string_model.
Instance Method Summary collapse
-
#abort? ⇒ Boolean
Safe to override.
- #initialize(source = nil, options = {}) ⇒ Object
-
#skip? ⇒ Boolean
Safe to override.
Methods included from DynamicColumns
#attributes, dynamic_column, dynamic_column_headers, dynamic_column_names, dynamic_column_options, dynamic_index, headers, is_dynamic_column?, singular_dynamic_attribute_method_name
Methods included from Children
#append_child, #child?, #children_public_send, #deep_public_send, has_many
Methods included from Columns
#array_to_block_hash, #attributes, #attributes_from_column_names, column, column_names, format_header, #headers, headers, index, is_column_name?, options, #to_json
Methods included from Validators::ValidateAttributes
Methods included from Concerns::InheritedClassVar
class_cache, clear_class_cache, deep_clear_class_cache, hidden_variable_name, inherited_ancestors, inherited_class_hash, inherited_class_var, inherited_class_variable_name, inherited_custom_class
Methods included from Concerns::InvalidOptions
Instance Attribute Details
#initialized_at ⇒ DateTime (readonly)
Return when self has been intialized
26 27 28 |
# File 'lib/csv_row_model/model.rb', line 26 def initialized_at @initialized_at end |
#parent ⇒ Model (readonly)
Return the parent, if this instance is a child
23 24 25 |
# File 'lib/csv_row_model/model.rb', line 23 def parent @parent end |
Class Method Details
.csv_string_model(&block) ⇒ Object (protected)
Called to add validations to the csv_string_model_class
61 62 63 |
# File 'lib/csv_row_model/model.rb', line 61 def csv_string_model(&block) csv_string_model_class.class_eval(&block) end |
.csv_string_model_class ⇒ Class
Returns the Class with validations of the csv_string_model.
55 56 57 |
# File 'lib/csv_row_model/model.rb', line 55 def csv_string_model_class @csv_string_model_class ||= inherited_custom_class(:csv_string_model_class, CsvStringModel) end |
Instance Method Details
#abort? ⇒ Boolean
Safe to override.
49 50 51 |
# File 'lib/csv_row_model/model.rb', line 49 def abort? false end |
#initialize(source = nil, options = {}) ⇒ Object
34 35 36 37 |
# File 'lib/csv_row_model/model.rb', line 34 def initialize(source=nil, ={}) @initialized_at = DateTime.now @parent = [:parent] end |
#skip? ⇒ Boolean
Safe to override.
42 43 44 |
# File 'lib/csv_row_model/model.rb', line 42 def skip? !valid? end |