Class: CoffeeParse

Inherits:
Object
  • Object
show all
Defined in:
lib/coffee_short_get.rb

Class Method Summary collapse

Class Method Details

.parse(body) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/coffee_short_get.rb', line 3

def parse(body)
  body = body.gsub(/@\$(\w+)/) do |str| 
    var = str[2..-1]
    "@get('#{var}')"
  end
  body = body.gsub(/\.\$(\w+)/) do |str| 
    var = str[2..-1]
    ".get('#{var}')"
  end
  body
end