Class: Skyline::Section

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/skyline/section.rb

Instance Method Summary collapse

Instance Method Details

#build_sectionable(sectionable_attributes) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
18
19
# File 'app/models/skyline/section.rb', line 14

def build_sectionable(sectionable_attributes)
  params = sectionable_attributes.dup
  raise ArgumentError, "Missing class parameter when building sectionable" unless params["class"]
  klass = params.delete("class")
  self.sectionable = klass.constantize.new(params)
end

#cloneObject



21
22
23
24
25
# File 'app/models/skyline/section.rb', line 21

def clone
  returning super do |clone|
    clone.sectionable = self.sectionable.clone
  end
end

#to_textObject

to_text

returns

String

plain text of section



30
31
32
# File 'app/models/skyline/section.rb', line 30

def to_text
  self.sectionable.to_text
end