Class: Sourcify::Common::Parser::RawScanner::Heredoc
- Defined in:
- lib/sourcify/lib/sourcify/common/parser/raw_scanner/heredoc.rb
Instance Attribute Summary collapse
-
#encoding ⇒ Object
Returns the value of attribute encoding.
-
#indented ⇒ Object
Returns the value of attribute indented.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
Instance Attribute Details
#encoding ⇒ Object
Returns the value of attribute encoding
5 6 7 |
# File 'lib/sourcify/lib/sourcify/common/parser/raw_scanner/heredoc.rb', line 5 def encoding @encoding end |
#indented ⇒ Object
Returns the value of attribute indented
5 6 7 |
# File 'lib/sourcify/lib/sourcify/common/parser/raw_scanner/heredoc.rb', line 5 def indented @indented end |
#tag ⇒ Object
Returns the value of attribute tag
5 6 7 |
# File 'lib/sourcify/lib/sourcify/common/parser/raw_scanner/heredoc.rb', line 5 def tag @tag end |
Instance Method Details
#<<(content) ⇒ Object
7 8 9 |
# File 'lib/sourcify/lib/sourcify/common/parser/raw_scanner/heredoc.rb', line 7 def <<(content) (@contents ||= []) << content end |
#closed?(sealer) ⇒ Boolean
15 16 17 18 19 20 |
# File 'lib/sourcify/lib/sourcify/common/parser/raw_scanner/heredoc.rb', line 15 def closed?(sealer) return false unless sealer == "\n" parts = @contents[-1].split("\n") return true if parts[-1] == tag indented && parts[-1].sub(/^\s*(.*)$/,'\1') == tag end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/sourcify/lib/sourcify/common/parser/raw_scanner/heredoc.rb', line 11 def to_s @contents.join.force_encoding(encoding) end |