Class: SourceMap::Mapping

Inherits:
Struct show all
Defined in:
opal/stdlib/source_map/mapping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#initialize, #to_n

Constructor Details

This class inherits a constructor from Struct

Instance Attribute Details

#generatedObject

Returns the value of attribute generated

Returns:

  • (Object)

    the current value of generated


4
5
6
# File 'opal/stdlib/source_map/mapping.rb', line 4

def generated
  @generated
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name


4
5
6
# File 'opal/stdlib/source_map/mapping.rb', line 4

def name
  @name
end

#originalObject

Returns the value of attribute original

Returns:

  • (Object)

    the current value of original


4
5
6
# File 'opal/stdlib/source_map/mapping.rb', line 4

def original
  @original
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source


4
5
6
# File 'opal/stdlib/source_map/mapping.rb', line 4

def source
  @source
end

Instance Method Details

#inspectObject

Public: Get a pretty inspect output for debugging purposes.

Returns a String.


18
19
20
21
22
23
24
# File 'opal/stdlib/source_map/mapping.rb', line 18

def inspect
  str = "#<#{self.class} source=#{source.inspect}"
  str << " generated=#{generated}, original=#{original}"
  str << " name=#{name.inspect}" if name
  str << ">"
  str
end

#to_sObject

Public: Get a simple string representation of the mapping.

Returns a String.


8
9
10
11
12
13
# File 'opal/stdlib/source_map/mapping.rb', line 8

def to_s
  str = "#{generated.line}:#{generated.column}"
  str << "->#{source}@#{original.line}:#{original.column}"
  str << "##{name}" if name
  str
end