Class: Dokaz::Block
- Inherits:
-
Object
- Object
- Dokaz::Block
- Defined in:
- lib/dokaz/parser.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
- #caption ⇒ Object
- #end_line ⇒ Object
-
#initialize(code, line, file) ⇒ Block
constructor
A new instance of Block.
- #inside?(ln) ⇒ Boolean
Constructor Details
#initialize(code, line, file) ⇒ Block
Returns a new instance of Block.
7 8 9 |
# File 'lib/dokaz/parser.rb', line 7 def initialize(code, line, file) @code, @line, @file = code, line, file end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/dokaz/parser.rb', line 6 def code @code end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/dokaz/parser.rb', line 6 def file @file end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
6 7 8 |
# File 'lib/dokaz/parser.rb', line 6 def line @line end |
Instance Method Details
#caption ⇒ Object
15 16 17 |
# File 'lib/dokaz/parser.rb', line 15 def caption "#{file}:#{line}" end |
#end_line ⇒ Object
11 12 13 |
# File 'lib/dokaz/parser.rb', line 11 def end_line line + code.count("\n") end |
#inside?(ln) ⇒ Boolean
19 20 21 |
# File 'lib/dokaz/parser.rb', line 19 def inside?(ln) (line..end_line).cover?(ln) end |