Module: CrazyHarry::Change

Included in:
Base
Defined in:
lib/crazy_harry/change.rb

Constant Summary collapse

BLOCK_CONVERSION_ELEMENTS =
{
  inlines:  %w(br),
  blocks:   %w(div p)
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fromObject

Returns the value of attribute from.



9
10
11
# File 'lib/crazy_harry/change.rb', line 9

def from
  @from
end

#toObject

Returns the value of attribute to.



9
10
11
# File 'lib/crazy_harry/change.rb', line 9

def to
  @to
end

Instance Method Details

#change!(opts) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/crazy_harry/change.rb', line 11

def change!(opts)
  self.from  =  opts.delete(:from)
  self.to    =  opts.delete(:to)
  self.text  =  opts.delete(:text)
  self.scope =  opts.delete(:scope)

  self.steps << generic_from_to
  self.steps << unwrap_unnecessary_paragraphs
  self.steps << foster_orphaned_nodes

  run!

  self
end