Class: LangScan::Fragment
- Defined in:
- lib/langscan/_common.rb,
lib/langscan/_common.rb
Overview
LangScan::Fragment has following variables.
-
type is symbol that denotes Type of the fragment(e.g. :string, :comment,…).
-
text is string that contains text of the fragment.
-
lineno is number of lines where the fragment appears.
-
byteno is number of bytes where the fragment appears.
Instance Attribute Summary collapse
-
#beg_byteno ⇒ Object
(also: #byteno)
Returns the value of attribute beg_byteno.
-
#beg_lineno ⇒ Object
(also: #lineno)
Returns the value of attribute beg_lineno.
-
#text ⇒ Object
Returns the value of attribute text.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#beg_byteno ⇒ Object Also known as: byteno
Returns the value of attribute beg_byteno
18 19 20 |
# File 'lib/langscan/_common.rb', line 18 def beg_byteno @beg_byteno end |
#beg_lineno ⇒ Object Also known as: lineno
Returns the value of attribute beg_lineno
18 19 20 |
# File 'lib/langscan/_common.rb', line 18 def beg_lineno @beg_lineno end |
#text ⇒ Object
Returns the value of attribute text
18 19 20 |
# File 'lib/langscan/_common.rb', line 18 def text @text end |
#type ⇒ Object
Returns the value of attribute type
18 19 20 |
# File 'lib/langscan/_common.rb', line 18 def type @type end |
Instance Method Details
#end_byteno ⇒ Object
39 40 41 |
# File 'lib/langscan/_common.rb', line 39 def end_byteno self.beg_byteno + self.text.length end |
#inspect ⇒ Object
31 32 33 |
# File 'lib/langscan/_common.rb', line 31 def inspect "\#<#{self.class} #{type} #{text.inspect} #{beg_lineno} (#{beg_byteno})>" end |
#pretty_print(q) ⇒ Object
35 36 37 |
# File 'lib/langscan/_common.rb', line 35 def pretty_print(q) q.text inspect end |