Skip to content

Instantly share code, notes, and snippets.

@marcoi
Created December 15, 2015 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcoi/f0202a8710700e924db2 to your computer and use it in GitHub Desktop.
Save marcoi/f0202a8710700e924db2 to your computer and use it in GitHub Desktop.
feedbuilder for lrug
class FeedBuilder
def self.build_class
Feed
end
data_object_name :feed_details
def initialize(consumer, feed_details, tag_builder=FeedDetail::TagBuilder.new)
super(consumer, feed_detail)
@tag_builder = tag_builder
end
property :id
#and many other properties
class WithDocuments < FeedBuilder
def self.properties
@properties ||= FeedBuilder.properties.clone
end
property :documents
def initialize(consumer, data, documents)
super(consumer, data)
@documents = documents
end
def documents
@documents.map do |document|
options = {
<etc.>
}
DocumentBuilder.new(consumer, document, options)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment