Class: BBCDataService::FeedFixture
- Inherits:
-
Object
- Object
- BBCDataService::FeedFixture
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Serialization
- Defined in:
- lib/bbc_data_service/feed_fixture.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#rdf_object ⇒ Object
Returns the value of attribute rdf_object.
Instance Method Summary collapse
- #add_relationship(name, values) ⇒ Object
-
#initialize(attributes = {}) ⇒ FeedFixture
constructor
A new instance of FeedFixture.
- #to_header ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ FeedFixture
Returns a new instance of FeedFixture.
9 10 11 12 13 14 15 16 17 |
# File 'lib/bbc_data_service/feed_fixture.rb', line 9 def initialize(attributes = {}) @attributes = attributes @attributes.each do |name, value| FeedFixture.instance_eval <<-EOS attr_accessor :#{name} EOS send("#{name}=", value.to_s) end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/bbc_data_service/feed_fixture.rb', line 7 def attributes @attributes end |
#rdf_object ⇒ Object
Returns the value of attribute rdf_object.
7 8 9 |
# File 'lib/bbc_data_service/feed_fixture.rb', line 7 def rdf_object @rdf_object end |
Instance Method Details
#add_relationship(name, values) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/bbc_data_service/feed_fixture.rb', line 19 def add_relationship(name, values) FeedFixture.class_eval <<-EOS attr_accessor :#{name} EOS send("#{name}=", values) end |
#to_header ⇒ Object
26 27 28 |
# File 'lib/bbc_data_service/feed_fixture.rb', line 26 def to_header @attributes.map{|key, value| "#{key.upcase}: #{value}" }.join("\r\n") end |