Class: Fable::VariableReference

Inherits:
RuntimeObject show all
Defined in:
lib/fable/variable_reference.rb

Instance Attribute Summary collapse

Attributes inherited from RuntimeObject

#original_object, #own_debug_metadata, #parent, #path

Instance Method Summary collapse

Methods inherited from RuntimeObject

#compact_path_string, #convert_path_to_relative, #copy, #debug_line_number_of_path, #debug_metadata, #indentation_string, #resolve_path, #root_content_container

Constructor Details

#initialize(name) ⇒ VariableReference

Returns a new instance of VariableReference.



25
26
27
28
# File 'lib/fable/variable_reference.rb', line 25

def initialize(name)
  super()
  self.name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/fable/variable_reference.rb', line 3

def name
  @name
end

#path_for_countObject

Returns the value of attribute path_for_count.



3
4
5
# File 'lib/fable/variable_reference.rb', line 3

def path_for_count
  @path_for_count
end

Instance Method Details

#container_for_countObject



5
6
7
# File 'lib/fable/variable_reference.rb', line 5

def container_for_count
  return self.resolve_path(self.path_for_count).container
end

#path_string_for_countObject



9
10
11
12
13
14
15
# File 'lib/fable/variable_reference.rb', line 9

def path_string_for_count
  if path_for_count.nil?
    return nil
  end

  return compact_path_string(path_for_count)
end

#path_string_for_count=(value) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/fable/variable_reference.rb', line 17

def path_string_for_count=(value)
  if value.nil?
    self.path_for_count = nil
  else
    self.path_for_count = Path.new(value)
  end
end

#to_sObject



30
31
32
33
34
35
36
# File 'lib/fable/variable_reference.rb', line 30

def to_s
  if !name.nil?
    return "var(#{name})"
  else
    return "read_count(#{path_string_for_count})"
  end
end