Class: JsonRander::JNumNode
- Inherits:
-
Object
- Object
- JsonRander::JNumNode
- 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
Direct Known Subclasses
JNumBigE, JNumDigit, JNumDot, JNumHead, JNumMinus, JNumPlus, JNumPositiveDigit, JNumSmallE, JNumTail, JNumZero
Instance Method Summary collapse
-
#initialize(*nexts) ⇒ JNumNode
constructor
next nodes symbol.
-
#is_head? ⇒ Boolean
head node?.
-
#is_tail? ⇒ Boolean
tail node?.
-
#random_next ⇒ Object
randomly get next node symbol.
-
#to_s ⇒ Object
to string method.
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?
15 16 17 |
# File 'lib/json_rander/json_num_builder.rb', line 15 def is_head? return false end |
#is_tail? ⇒ Boolean
tail node?
20 21 22 |
# File 'lib/json_rander/json_num_builder.rb', line 20 def is_tail? return false end |
#random_next ⇒ Object
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_s ⇒ Object
to string method
30 31 32 |
# File 'lib/json_rander/json_num_builder.rb', line 30 def to_s return "" end |