Class: Creamerscript::Sweeteners::PropertyInvocation

Inherits:
Base
  • Object
show all
Defined in:
lib/creamerscript/sweeteners/property_invocation.rb

Constant Summary

Constants inherited from Base

Base::SYMBOL

Instance Attribute Summary

Attributes inherited from Base

#source, #substitutions

Instance Method Summary collapse

Methods inherited from Base

#call, #initialize, #substitute, #token, #tokenize, #type

Constructor Details

This class inherits a constructor from Creamerscript::Sweeteners::Base

Instance Method Details

#patternObject



4
5
6
# File 'lib/creamerscript/sweeteners/property_invocation.rb', line 4

def pattern
  /\(#{SYMBOL} #{SYMBOL}\)/
end

#property_nameObject



16
17
18
# File 'lib/creamerscript/sweeteners/property_invocation.rb', line 16

def property_name
  body.split.last
end

#subjectObject



12
13
14
# File 'lib/creamerscript/sweeteners/property_invocation.rb', line 12

def subject
  body.split.first
end

#to_coffeeObject



8
9
10
# File 'lib/creamerscript/sweeteners/property_invocation.rb', line 8

def to_coffee
  "#{subject}.#{property_name}"
end