Class: ActiveTriples::List::ListResource
- 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 inherited from Resource
Instance Method Summary collapse
Methods inherited from Resource
#[], #[]=, #attributes, #base_uri, #destroy, #destroy_child, #destroyed?, #dump, #fetch, #fields, #final_parent, from_uri, #get_term, #get_values, #graph, #id, #initialize, #mark_for_destruction, #marked_for_destruction?, #new_record?, #node?, #persist!, #persisted?, #rdf_label, #rdf_subject, #reload, #serializable_hash, #set_subject!, #set_value, #solrize, #type, #type=, type_registry, #writable?
Methods included from Configurable
#base_uri, #configure, #rdf_label, #rdf_type, #repository, #transform_type, #type
Methods included from Reflection
Constructor Details
This class inherits a constructor from ActiveTriples::Resource
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
101 102 103 |
# File 'lib/active_triples/list.rb', line 101 def list @list end |
Instance Method Details
#attributes=(values) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/active_triples/list.rb', line 111 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
107 108 109 |
# File 'lib/active_triples/list.rb', line 107 def reflections @list.class end |