Class: ViewModels::Extensions::ModelReader::Options
- Inherits:
-
Object
- Object
- ViewModels::Extensions::ModelReader::Options
- Defined in:
- lib/view_models/extensions/model_reader.rb
Overview
Bundles the model reader options and extracts the relevant structured data.
Instance Attribute Summary (collapse)
-
- (Object) attributes
readonly
Returns the value of attribute attributes.
-
- (Object) filters
readonly
Returns the value of attribute filters.
Instance Method Summary (collapse)
-
- (Options) initialize(*attributes_and_options)
constructor
A new instance of Options.
-
- (Object) split(options)
Extract filter_through options from the options hash if there are any.
-
- (Array) to_a
Render the options to an array.
Constructor Details
- (Options) initialize(*attributes_and_options)
A new instance of Options
38 39 40 |
# File 'lib/view_models/extensions/model_reader.rb', line 38 def initialize * split end |
Instance Attribute Details
- (Object) attributes (readonly)
Returns the value of attribute attributes
36 37 38 |
# File 'lib/view_models/extensions/model_reader.rb', line 36 def attributes @attributes end |
- (Object) filters (readonly)
Returns the value of attribute filters
36 37 38 |
# File 'lib/view_models/extensions/model_reader.rb', line 36 def filters @filters end |
Instance Method Details
- (Object) split(options)
Extract filter_through options from the options hash if there are any.
45 46 47 48 49 50 51 52 |
# File 'lib/view_models/extensions/model_reader.rb', line 45 def split @filters = if .last.kind_of?(Hash) [*(.pop[:filter_through])].reverse else [] end @attributes = end |
- (Array) to_a
Render the options to an array
57 58 59 |
# File 'lib/view_models/extensions/model_reader.rb', line 57 def to_a [attributes, filters] end |