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.
Instance Method Summary collapse
Methods included from RDFSource
#==, #[], #[]=, #add_observer, #attributes, #base_uri, #count, #default_labels, #delete_observer, #dump, #each, #escape, #fetch, #get_relation, #get_values, #graph_name, #has_statement?, #humanize, #id, #initialize, #inspect, #load!, #mark_for_destruction, #marked_for_destruction?, #new_record?, #node?, #notify_observers, #parent, #parent=, #query, #rdf_label, #rdf_subject, #serializable_hash, #set_subject!, #set_value, #term?, #to_base, #to_uri, #type, #type=, type_registry, #uri?
Methods included from Persistable
#delete_statement, #destroy, #destroyed?, #graph, #insert_statement, #persist!, #persisted?, #persistence_strategy, #reload, #set_persistence_strategy
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
95 96 97 |
# File 'lib/active_triples/list.rb', line 95 def list @list end |
Instance Method Details
#attributes=(values) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/active_triples/list.rb', line 105 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 super end |
#reflections ⇒ Object
101 102 103 |
# File 'lib/active_triples/list.rb', line 101 def reflections @list.class end |