Class: Lydown::Parsing::Setting

Inherits:
Root
  • Object
show all
Defined in:
lib/lydown/parsing/nodes.rb

Defined Under Namespace

Modules: Key, Value

Instance Method Summary collapse

Methods inherited from Root

#initialize

Methods included from RootMethods

#_to_stream, #add_event, #each_child, #event_hash

Constructor Details

This class inherits a constructor from Lydown::Parsing::Root

Instance Method Details

#emit_setting(stream) ⇒ Object



87
88
89
# File 'lib/lydown/parsing/nodes.rb', line 87

def emit_setting(stream)
  stream << @setting
end

#settingObject



83
84
85
# File 'lib/lydown/parsing/nodes.rb', line 83

def setting
  @setting
end

#to_stream(stream, opts) ⇒ Object



75
76
77
78
79
80
81
# File 'lib/lydown/parsing/nodes.rb', line 75

def to_stream(stream, opts)
  level = (text_value =~ /^([\s]+)/) ? ($1.length / 2) : 0
  @setting = event_hash(stream, opts, {
    type: :setting, level: level
  })
  _to_stream(self, stream, opts)
end