class Paru::PandocFilter::Value
A Value
node that represents some sort of metadata about block or inline nodes
Public Class Methods
new(contents)
click to toggle source
Create a new Value
with contents. Also indicate if this node has inline children or block children.
@param contents [Array<pandoc node in JSON> = []] the contents of
this node
# File lib/paru/filter/value.rb, line 37 def initialize(contents) @type = contents['t'] if contents.has_key? 'c' then @value = contents['c'] else @value = VALUE_ENCODED_IN_TYPE_NAME end end
Public Instance Methods
ast_type()
click to toggle source
The AST type of this Node
@return [String]
# File lib/paru/filter/value.rb, line 86 def ast_type() @type end
is_block?()
click to toggle source
Is this node a block?
@return [Boolean] false
# File lib/paru/filter/value.rb, line 72 def is_block? false end
is_inline?()
click to toggle source
Is this node an inline node?
@return [Boolean] false
# File lib/paru/filter/value.rb, line 79 def is_inline? false end
to_ast()
click to toggle source
Create an AST representation of this Node
@return [Hash]
# File lib/paru/filter/value.rb, line 93 def to_ast() return { "t" => ast_type, "c" => if type_encodes_value? then nil else @value end } end
type_encodes_value?()
click to toggle source
# File lib/paru/filter/value.rb, line 101 def type_encodes_value?() return @value == VALUE_ENCODED_IN_TYPE_NAME end
value()
click to toggle source
Get the encoded value
@return [Any]
# File lib/paru/filter/value.rb, line 50 def value() if type_encodes_value? then @type else @value end end
value=(new_value)
click to toggle source
Set the encoded value
@param [Any] new_value
# File lib/paru/filter/value.rb, line 61 def value=(new_value) if type_encodes_value? then @type = new_value else @value = new_value end end