Class: MOSAIK::Syntax::Method

Inherits:
Object
  • Object
show all
Defined in:
lib/mosaik/syntax/method.rb

Overview

Method in the codebase

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(constant, name, file = nil, line = nil) ⇒ Method

Returns a new instance of Method.



11
12
13
14
15
16
17
18
# File 'lib/mosaik/syntax/method.rb', line 11

def initialize(constant, name, file = nil, line = nil)
  @constant = constant
  @name = name
  @file = file
  @line = line

  @references = []
end

Instance Attribute Details

#constantObject (readonly)

Returns the value of attribute constant.



9
10
11
# File 'lib/mosaik/syntax/method.rb', line 9

def constant
  @constant
end

#fileObject (readonly)

Returns the value of attribute file.



9
10
11
# File 'lib/mosaik/syntax/method.rb', line 9

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



9
10
11
# File 'lib/mosaik/syntax/method.rb', line 9

def line
  @line
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/mosaik/syntax/method.rb', line 9

def name
  @name
end

#referencesObject (readonly)

Returns the value of attribute references.



9
10
11
# File 'lib/mosaik/syntax/method.rb', line 9

def references
  @references
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
23
# File 'lib/mosaik/syntax/method.rb', line 20

def ==(other)
  constant == other.constant &&
    name == other.name
end

#inspectObject



33
34
35
# File 'lib/mosaik/syntax/method.rb', line 33

def inspect
  "#<Method #{self}>"
end

#to_sObject



25
26
27
28
29
30
31
# File 'lib/mosaik/syntax/method.rb', line 25

def to_s
  [
    name,
    "#{file}:#{line}",
    "(#{references.size} references)",
  ].compact.join(" ")
end