class Paru::PandocFilter::Value
A Value
node that represents some sort of metadata about block or inline nodes
Public Class Methods
Source
# 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
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
Public Instance Methods
Source
# File lib/paru/filter/value.rb, line 86 def ast_type() @type end
The AST type of this Node
@return [String]
Source
# File lib/paru/filter/value.rb, line 72 def is_block? false end
Is this node a block?
@return [Boolean] false
Source
# File lib/paru/filter/value.rb, line 79 def is_inline? false end
Is this node an inline node?
@return [Boolean] false
Source
# 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
Create an AST representation of this Node
@return [Hash]
Source
# File lib/paru/filter/value.rb, line 101 def type_encodes_value?() return @value == VALUE_ENCODED_IN_TYPE_NAME end
Source
# File lib/paru/filter/value.rb, line 50 def value() if type_encodes_value? then @type else @value end end
Get the encoded value
@return [Any]
Source
# 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
Set the encoded value
@param [Any] new_value