Module: RDFForSQLite

Defined in:
lib/rdf_for_sqlite.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/rdf_for_sqlite.rb', line 46

def self.included(base)
  base.send(:include, Spira::Resource)
  base.send(:include, RDF)
  base.send(:include, ActiveModel::Conversion)
  base.extend ActiveModel::Naming
  base.send(:include, FleetVentures::Serialization)
  base.send(:include, ActiveModel::Serializers::JSON)
  base.send(:include, ActiveModel::Serializers::Xml)
end

Instance Method Details

#initialize(attributes = {}) ⇒ Object



56
57
58
59
60
61
# File 'lib/rdf_for_sqlite.rb', line 56

def initialize(attributes = {})
  super
  attributes.each do |name, value|
    self.send("#{name}=", value)
  end
end

#persisted?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/rdf_for_sqlite.rb', line 63

def persisted?
  self.send(:exist?)
end

#update_attribute(name, value) ⇒ Object



75
76
77
78
79
# File 'lib/rdf_for_sqlite.rb', line 75

def update_attribute(name, value)
  self.send("#{name}=", value)
  self.save!
  self
end

#update_attributes(hash) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/rdf_for_sqlite.rb', line 67

def update_attributes(hash)
  hash.each do |name, value|
    self.send("#{name}=", value)
  end
  self.save!
  self
end