2017-09-27 14:35:55 +02:00
|
|
|
module RxFile
|
2015-06-13 22:09:02 +02:00
|
|
|
|
|
|
|
# What makes a node simple is that it has no further structure
|
|
|
|
#
|
2015-06-15 07:21:15 +02:00
|
|
|
# This may mean number/string/symbol, but also tiny arrays or objects with
|
|
|
|
# very little attributes. In other words simple/object is not the same distinction
|
|
|
|
# as value/not value
|
|
|
|
|
2015-06-13 22:09:02 +02:00
|
|
|
class SimpleNode < Node
|
2015-06-15 07:21:15 +02:00
|
|
|
|
|
|
|
# data is a string that is written out in "out" function
|
2015-06-19 15:53:19 +02:00
|
|
|
def initialize data
|
|
|
|
super(nil) # simple nodes can not be referenced, always value
|
2015-06-13 22:09:02 +02:00
|
|
|
@data = data
|
|
|
|
end
|
2015-06-15 07:21:15 +02:00
|
|
|
|
2015-06-17 20:16:39 +02:00
|
|
|
# A SimpleNode is always simple (aha).
|
|
|
|
# accordingly there is no long_out
|
|
|
|
def is_simple?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
2015-06-15 07:21:15 +02:00
|
|
|
# just write the data given in construcor. simple. hence the name.
|
2015-06-17 20:16:39 +02:00
|
|
|
def short_out io , level
|
|
|
|
io.write(@data)
|
2015-06-13 22:09:02 +02:00
|
|
|
end
|
|
|
|
end
|
2015-06-15 07:21:15 +02:00
|
|
|
|
2015-06-13 22:09:02 +02:00
|
|
|
end
|