Class: Pageflow::StorylineScaffold

Inherits:
Object
  • Object
show all
Defined in:
app/models/pageflow/storyline_scaffold.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(storyline, options) ⇒ StorylineScaffold

Returns a new instance of StorylineScaffold.



3
4
5
6
# File 'app/models/pageflow/storyline_scaffold.rb', line 3

def initialize(storyline, options)
  @storyline = storyline
  @options = options
end

Class Method Details

.build(revision, attributes, options) ⇒ Object



23
24
25
# File 'app/models/pageflow/storyline_scaffold.rb', line 23

def self.build(revision, attributes, options)
  new(revision.storylines.build(attributes), options).build
end

Instance Method Details

#as_json(_ = {}) ⇒ Object



15
16
17
# File 'app/models/pageflow/storyline_scaffold.rb', line 15

def as_json(_ = {})
  @chapter_scaffold.as_json.merge(storyline: @storyline)
end

#buildObject



10
11
12
13
# File 'app/models/pageflow/storyline_scaffold.rb', line 10

def build
  @chapter_scaffold = ChapterScaffold.build(@storyline, {}, @options)
  self
end

#to_modelObject



19
20
21
# File 'app/models/pageflow/storyline_scaffold.rb', line 19

def to_model
  @storyline
end