Class: ActiveTriples::List::ListResource
- Inherits:
-
Object
- Object
- ActiveTriples::List::ListResource
- Includes:
- RDFSource
- Defined in:
- lib/active_triples/list.rb
Overview
This class is the graph/Resource that backs the List and supplies integration with the rest of ActiveTriples
Instance Attribute Summary collapse
-
#list ⇒ Object
Returns the value of attribute list.
Attributes included from RDFSource
Instance Method Summary collapse
Methods included from RDFSource
#[], #[]=, #attributes, #base_uri, #destroy, #destroy_child, #destroyed?, #dump, #fetch, #fields, #final_parent, #get_relation, #get_values, #id, #initialize, #mark_for_destruction, #marked_for_destruction?, #new_record?, #node?, #persist!, #persisted?, #rdf_label, #rdf_subject, #reload, #serializable_hash, #set_subject!, #set_value, #type, #type=, type_registry, #writable?
Methods included from Reflection
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
103 104 105 |
# File 'lib/active_triples/list.rb', line 103 def list @list end |
Instance Method Details
#attributes=(values) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/active_triples/list.rb', line 113 def attributes=(values) raise ArgumentError, "values must be a Hash, you provided #{values.class}" unless values.kind_of? Hash values.with_indifferent_access.each do |key, value| if reflections.properties.keys.map { |k| "#{k}_attributes" }.include?(key) klass = reflections.reflect_on_property(key[0..-12])['class_name'] klass = ActiveTriples.class_from_string(klass, final_parent.class) if klass.is_a? String value.is_a?(Hash) ? attributes_hash_to_list(values[key], klass) : attributes_to_list(value, klass) values.delete key end end persist! super end |
#reflections ⇒ Object
109 110 111 |
# File 'lib/active_triples/list.rb', line 109 def reflections @list.class end |