Module: Conchiterz

Extended by:
Conchiterz
Included in:
Conchiterz
Defined in:
lib/version.rb,
lib/conchiterz.rb

Defined Under Namespace

Modules: StringMethods

Constant Summary collapse

VERSION =
"1.2.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/conchiterz.rb', line 8

def result
  @result
end

Instance Method Details

#monkey_patch(str) ⇒ Object



29
30
31
# File 'lib/conchiterz.rb', line 29

def monkey_patch(str)
  str.send(:include, Conchiterz::StringMethods)
end

#translate(string, switch, escape = []) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/conchiterz.rb', line 16

def translate(string, switch, escape = [])
  return if string.nil?
  return string unless switch

  @result = []
  a_words = string.scan(Config::REGEXP)
  a_words.each do |word|
    Typography.new(word, escape, result).call
  end
  Punctuation.new(result).call
  result.join(' ')
end