Class: CodeModels::EmbeddedArtifact
Overview
Represent a snippet embedded in something else
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Artifact
#initialize, #point_to_absolute, #position_to_absolute
Instance Attribute Details
#host_artifact ⇒ Object
Returns the value of attribute host_artifact.
38
39
40
|
# File 'lib/codemodels/artifact.rb', line 38
def host_artifact
@host_artifact
end
|
#position_in_host ⇒ Object
Returns the value of attribute position_in_host.
39
40
41
|
# File 'lib/codemodels/artifact.rb', line 39
def position_in_host
@position_in_host
end
|
Instance Method Details
#absolute_start ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/codemodels/artifact.rb', line 41
def absolute_start
p = host_artifact.absolute_start
p.line += position_in_host.begin_point.line-1
if position_in_host.begin_point.line==1
p.column += position_in_host.begin_point.column-1
else
p.column = position_in_host.begin_point.column
end
p
end
|
#code ⇒ Object
63
64
65
|
# File 'lib/codemodels/artifact.rb', line 63
def code
position_in_host.get_string(host_artifact.code)
end
|
#embedded? ⇒ Boolean
67
68
69
|
# File 'lib/codemodels/artifact.rb', line 67
def embedded?
true
end
|
#embedding_level ⇒ Object
71
72
73
|
# File 'lib/codemodels/artifact.rb', line 71
def embedding_level
@host_artifact.embedding_level+1
end
|
#final_host ⇒ Object
59
60
61
|
# File 'lib/codemodels/artifact.rb', line 59
def final_host
host_artifact.final_host
end
|
#name ⇒ Object
75
76
77
|
# File 'lib/codemodels/artifact.rb', line 75
def name
'<embedded>'
end
|
#to_s ⇒ Object
55
56
57
|
# File 'lib/codemodels/artifact.rb', line 55
def to_s
"Embedded in (#{@host_artifact.to_s}) at #{position_in_host}"
end
|