Class: Knish::Member
- Inherits:
-
Struct
- Object
- Struct
- Knish::Member
- Defined in:
- lib/knish/member.rb
Instance Attribute Summary collapse
-
#collection_config ⇒ Object
Returns the value of attribute collection_config.
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #class_name ⇒ Object
- #data ⇒ Object
- #loaded_model ⇒ Object
- #model ⇒ Object
- #model_class ⇒ Object
- #reader ⇒ Object
Instance Attribute Details
#collection_config ⇒ Object
Returns the value of attribute collection_config
2 3 4 |
# File 'lib/knish/member.rb', line 2 def collection_config @collection_config end |
#config ⇒ Object
Returns the value of attribute config
2 3 4 |
# File 'lib/knish/member.rb', line 2 def config @config end |
Instance Method Details
#class_name ⇒ Object
15 16 17 |
# File 'lib/knish/member.rb', line 15 def class_name data[config.type_key] end |
#data ⇒ Object
23 24 25 |
# File 'lib/knish/member.rb', line 23 def data @data ||= reader.get_json end |
#loaded_model ⇒ Object
10 11 12 13 |
# File 'lib/knish/member.rb', line 10 def loaded_model model.load model end |
#model ⇒ Object
3 4 5 6 7 8 |
# File 'lib/knish/member.rb', line 3 def model return @model if @model @model = model_class.new(id: config.id) @model.config = collection_config.member_config(@model.config, config.id) @model end |
#model_class ⇒ Object
19 20 21 |
# File 'lib/knish/member.rb', line 19 def model_class class_name && eval(class_name) end |