Class: CodeModels::EmbeddedArtifact

Inherits:
AbstractArtifact show all
Defined in:
lib/codemodels/artifact.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractArtifact

#point_to_absolute, #position_to_absolute

Instance Attribute Details

#host_artifactObject

Returns the value of attribute host_artifact.



27
28
29
# File 'lib/codemodels/artifact.rb', line 27

def host_artifact
  @host_artifact
end

#position_in_hostObject

Returns the value of attribute position_in_host.



28
29
30
# File 'lib/codemodels/artifact.rb', line 28

def position_in_host
  @position_in_host
end

Instance Method Details

#absolute_startObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/codemodels/artifact.rb', line 30

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      
    # if I am on the first line of my "host", its column
    # matters because there are not newlines to reset the column
    # counter
    p.column += position_in_host.begin_point.column-1 
  else
    p.column = position_in_host.begin_point.column
  end
  p
end

#codeObject



52
53
54
# File 'lib/codemodels/artifact.rb', line 52

def code
  position_in_host.get_string(host_artifact.code)
end

#embedded?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/codemodels/artifact.rb', line 56

def embedded?
  true
end

#embedding_levelObject



60
61
62
# File 'lib/codemodels/artifact.rb', line 60

def embedding_level
  @host_artifact.embedding_level+1
end

#final_hostObject



48
49
50
# File 'lib/codemodels/artifact.rb', line 48

def final_host
  host_artifact.final_host
end

#nameObject



64
65
66
# File 'lib/codemodels/artifact.rb', line 64

def name
  '<embedded>'
end

#to_sObject



44
45
46
# File 'lib/codemodels/artifact.rb', line 44

def to_s
  "Embedded in (#{@host_artifact.to_s}) at #{position_in_host}"
end