Class: JsonRander::JNumNode

Inherits:
Object
  • Object
show all
Defined in:
lib/json_rander/json_num_builder.rb

Overview

nodes at num walking map ref: www.json.org/json-ja.html node base class

Instance Method Summary collapse

Constructor Details

#initialize(*nexts) ⇒ JNumNode

next nodes symbol



10
11
12
# File 'lib/json_rander/json_num_builder.rb', line 10

def initialize(*nexts)
  @next_nodes = nexts
end

Instance Method Details

#is_head?Boolean

head node?

Returns:

  • (Boolean)


15
16
17
# File 'lib/json_rander/json_num_builder.rb', line 15

def is_head?
  return false
end

#is_tail?Boolean

tail node?

Returns:

  • (Boolean)


20
21
22
# File 'lib/json_rander/json_num_builder.rb', line 20

def is_tail?
  return false
end

#random_nextObject

randomly get next node symbol



25
26
27
# File 'lib/json_rander/json_num_builder.rb', line 25

def random_next
   return @next_nodes.sample
end

#to_sObject

to string method



30
31
32
# File 'lib/json_rander/json_num_builder.rb', line 30

def to_s
    return ""
end