Class: WLang::Scope::ObjectScope
Instance Attribute Summary
Attributes inherited from WLang::Scope
#parent, #subject
Instance Method Summary
collapse
chain, coerce, #evaluate, #initialize, null, #pop, #push, #root, #subjects, #with
Constructor Details
This class inherits a constructor from WLang::Scope
Instance Method Details
#fetch(key, dialect = nil, unfound = nil) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/wlang/scope/object_scope.rb', line 5
def fetch(key, dialect = nil, unfound = nil)
s = subject
if key == :self
return s
end
if s.respond_to?(:has_key?)
return s[key] if s.has_key?(key)
return s[key.to_s] if s.has_key?(key.to_s)
end
if s.respond_to?(key)
return s.send(key)
end
safe_parent.fetch(key, dialect, unfound)
rescue NameError
safe_parent.fetch(key, dialect, unfound)
end
|
#inspect ⇒ Object
34
35
36
|
# File 'lib/wlang/scope/object_scope.rb', line 34
def inspect
"ObjectScope(#{subject.inspect})"
end
|
#to_s ⇒ Object
29
30
31
32
|
# File 'lib/wlang/scope/object_scope.rb', line 29
def to_s
subj = subject.is_a?(Scope) ? subject.to_s : subject.class
"ObjectScope(#{subj})"
end
|