Module: CrazyHarry::Translate

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#add_attributesObject

Returns the value of attribute add_attributes.



4
5
6
# File 'lib/crazy_harry/translate.rb', line 4

def add_attributes
  @add_attributes
end

#from_textObject

Returns the value of attribute from_text.



4
5
6
# File 'lib/crazy_harry/translate.rb', line 4

def from_text
  @from_text
end

#to_textObject

Returns the value of attribute to_text.



4
5
6
# File 'lib/crazy_harry/translate.rb', line 4

def to_text
  @to_text
end

Instance Method Details

#translate!(opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/crazy_harry/translate.rb', line 6

def translate!(opts = {})
  self.add_attributes   = opts.delete(:add_attributes)
  self.from_text        = opts.delete(:from_text)
  self.to_text          = opts.delete(:to_text)
  self.text             = opts.delete(:text)
  self.scope            = opts.delete(:scope)

  self.steps << change_attributes if self.add_attributes
  self.steps << change_text if change_text?

  run!

  self
end