Class: Yamlt::Parser::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/yamlt/parser/line.rb,
lib/yamlt/parser/line/serializer.rb

Defined Under Namespace

Classes: Serializer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Line

Returns a new instance of Line


11
12
13
14
# File 'lib/yamlt/parser/line.rb', line 11

def initialize(text)
  @text = text
  parse
end

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor


16
17
18
# File 'lib/yamlt/parser/line.rb', line 16

def anchor
  @anchor
end

#cleanObject (readonly)

Returns the value of attribute clean


16
17
18
# File 'lib/yamlt/parser/line.rb', line 16

def clean
  @clean
end

#commentObject (readonly)

Returns the value of attribute comment


16
17
18
# File 'lib/yamlt/parser/line.rb', line 16

def comment
  @comment
end

#comment_prefixObject (readonly)

Returns the value of attribute comment_prefix


17
18
19
# File 'lib/yamlt/parser/line.rb', line 17

def comment_prefix
  @comment_prefix
end

#fragmentObject (readonly)

Returns the value of attribute fragment


16
17
18
# File 'lib/yamlt/parser/line.rb', line 16

def fragment
  @fragment
end

#full_pathObject

Returns the value of attribute full_path


18
19
20
# File 'lib/yamlt/parser/line.rb', line 18

def full_path
  @full_path
end

#levelObject (readonly)

Returns the value of attribute level


16
17
18
# File 'lib/yamlt/parser/line.rb', line 16

def level
  @level
end

#multilineObject (readonly)

Returns the value of attribute multiline


16
17
18
# File 'lib/yamlt/parser/line.rb', line 16

def multiline
  @multiline
end

#prefixObject (readonly)

Returns the value of attribute prefix


16
17
18
# File 'lib/yamlt/parser/line.rb', line 16

def prefix
  @prefix
end

#valueObject

Returns the value of attribute value


18
19
20
# File 'lib/yamlt/parser/line.rb', line 18

def value
  @value
end

Instance Method Details

#as_text(opts = {}) ⇒ Object


20
21
22
23
# File 'lib/yamlt/parser/line.rb', line 20

def as_text(opts={})
  serializer = Serializer.new(self, opts)
  serializer.to_s
end

#empty?Boolean

Returns:

  • (Boolean)

25
26
27
# File 'lib/yamlt/parser/line.rb', line 25

def empty?
  !@fragment && !@value
end