Class: Rubinius::ConstantScope

Inherits:
Object
  • Object
show all
Defined in:
lib/myco/bootstrap/find_constant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#is_myco_levelObject (readonly)

Returns the value of attribute is_myco_level.



9
10
11
# File 'lib/myco/bootstrap/find_constant.rb', line 9

def is_myco_level
  @is_myco_level
end

#myco_categoryObject (readonly)

Returns the value of attribute myco_category.



7
8
9
# File 'lib/myco/bootstrap/find_constant.rb', line 7

def myco_category
  @myco_category
end

#myco_componentObject (readonly)

Returns the value of attribute myco_component.



6
7
8
# File 'lib/myco/bootstrap/find_constant.rb', line 6

def myco_component
  @myco_component
end

#myco_fileObject (readonly)

TODO: Can this be more graceful and more eager?



21
22
23
# File 'lib/myco/bootstrap/find_constant.rb', line 21

def myco_file
  @myco_file
end

#myco_memeObject (readonly)

Returns the value of attribute myco_meme.



8
9
10
# File 'lib/myco/bootstrap/find_constant.rb', line 8

def myco_meme
  @myco_meme
end

Instance Method Details

#get_myco_constant_ref(name) ⇒ Object



75
76
77
78
# File 'lib/myco/bootstrap/find_constant.rb', line 75

def get_myco_constant_ref(name)
  @myco_constant_refs ||= Rubinius::LookupTable.new
  @myco_constant_refs[name] ||= ::Myco::ConstantReference.new(name, self)
end

#inspectObject



16
17
18
# File 'lib/myco/bootstrap/find_constant.rb', line 16

def inspect
  "#<#{self.class}:#{inspect_list}>"
end

#inspect_listObject



11
12
13
14
# File 'lib/myco/bootstrap/find_constant.rb', line 11

def inspect_list
  this_item = "0x#{object_id.to_s(16)} #{self.module}"
  parent ? "#{this_item}, #{parent.inspect_list}" : this_item
end

#myco_levelsObject



25
26
27
# File 'lib/myco/bootstrap/find_constant.rb', line 25

def myco_levels
  @myco_levels ||= (parent ? parent.myco_levels.dup : [])
end

#myco_parentObject



29
30
31
32
33
34
# File 'lib/myco/bootstrap/find_constant.rb', line 29

def myco_parent
  parent = parent()
  parent ? (
    parent.is_myco_level ? parent : parent.myco_parent
  ) : nil
end

#set_myco_categoryObject



58
59
60
61
62
63
64
65
66
67
# File 'lib/myco/bootstrap/find_constant.rb', line 58

def set_myco_category
  raise "myco_category already set for thie ConstantScope" \
    if @myco_category
  @myco_category  = self.module
  @myco_component = parent.myco_component
  @myco_file      = parent.myco_file
  
  myco_levels << @myco_category
  @is_myco_level = true
end

#set_myco_componentObject



48
49
50
51
52
53
54
55
56
# File 'lib/myco/bootstrap/find_constant.rb', line 48

def set_myco_component
  raise "myco_component already set for thie ConstantScope" \
    if @myco_component
  @myco_component = self.module
  @myco_file      = parent.myco_file
  
  myco_levels << @myco_component
  @is_myco_level = true
end

#set_myco_fileObject



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/myco/bootstrap/find_constant.rb', line 36

def set_myco_file
  raise "myco_file already set for thie ConstantScope" \
    if @myco_file
  @myco_component = self.module
  @myco_file      = self.module
  
  @myco_file.instance_variable_set(:@constant_scope, self)
  
  myco_levels << @myco_file
  @is_myco_level = true
end

#set_myco_meme(value) ⇒ Object



69
70
71
72
73
# File 'lib/myco/bootstrap/find_constant.rb', line 69

def set_myco_meme value
  raise "myco_meme already set for thie ConstantScope" \
    if @myco_meme
  @myco_meme      = value
end