Class: CaseCheck::Cfc
- Defined in:
- lib/case_check/references/cfc.rb
Overview
Reference as createObject(“component”, ‘…’)
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#expected_path ⇒ Object
readonly
Returns the value of attribute expected_path.
-
#resolved_to ⇒ Object
readonly
Returns the value of attribute resolved_to.
Attributes inherited from Reference
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source, text, line_number) ⇒ Cfc
constructor
A new instance of Cfc.
Methods inherited from Reference
#message, #resolution, #substituted_text, substitutions, #type_name
Constructor Details
#initialize(source, text, line_number) ⇒ Cfc
Returns a new instance of Cfc.
25 26 27 28 29 30 31 |
# File 'lib/case_check/references/cfc.rb', line 25 def initialize(source, text, line_number) super @expected_path = substituted_text.gsub('.', '/') + ".cfc" @resolved_to = search_path.inject(nil) do |resolved, dir| resolved || resolve_in(dir) end end |
Class Attribute Details
.directories ⇒ Object
10 11 12 |
# File 'lib/case_check/references/cfc.rb', line 10 def directories @directories ||= [] end |
Instance Attribute Details
#expected_path ⇒ Object (readonly)
Returns the value of attribute expected_path.
5 6 7 |
# File 'lib/case_check/references/cfc.rb', line 5 def expected_path @expected_path end |
#resolved_to ⇒ Object (readonly)
Returns the value of attribute resolved_to.
5 6 7 |
# File 'lib/case_check/references/cfc.rb', line 5 def resolved_to @resolved_to end |
Class Method Details
.search(source) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/case_check/references/cfc.rb', line 14 def search(source) source.scan(/createObject\((.*?)\)/mi) do |match, l| args = match[1].split(/\s*,\s*/).collect { |a| a.gsub(/['"]/, '') } unless args.size == 2 && args.first =~ /component/i $stderr.puts "Non-CFC call on line #{l} of #{source.filename}: #{match[0]}" end new(source, args.last, l) end end |