-
-
Save marcoi/f0202a8710700e924db2 to your computer and use it in GitHub Desktop.
feedbuilder for lrug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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