Class: Regextest::Front::Empty::TEmpty

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/regextest/front/empty.rb

Constant Summary collapse

@@id =

a class variable for generating unique name of element

0

Constants included from Common

Common::TstConstDebug, Common::TstConstRecursionMax, Common::TstConstRepeatMax, Common::TstConstRetryMax, Common::TstConstRetryMaxSecond, Common::TstConstTimeout, Common::TstConstUnicodeCharSet, Common::TstFixnumMax

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common

#TstLog, #TstMdPrint, #TstRand, #TstShuffle, #is_random?, #reset_random_called

Constructor Details

#initializeTEmpty

Constructor



14
15
16
17
18
# File 'lib/regextest/front/empty.rb', line 14

def initialize
  TstLog("Empty: ")
  @offset = -1
  @length = 0
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



20
21
22
# File 'lib/regextest/front/empty.rb', line 20

def length
  @length
end

#offsetObject (readonly)

Returns the value of attribute offset.



20
21
22
# File 'lib/regextest/front/empty.rb', line 20

def offset
  @offset
end

Instance Method Details

#jsonObject

generate json format



30
31
32
33
34
35
36
# File 'lib/regextest/front/empty.rb', line 30

def json
  @@id += 1
    "{" +
       "\"type\": \"LEX_EMPTY\", \"id\": \"E#{@@id}\", \"value\": \"\", " +
       "\"offset\": #{@offset}, \"length\": #{@length}" +
    "}"
end

#set_options(options) ⇒ Object

set options



23
24
25
26
27
# File 'lib/regextest/front/empty.rb', line 23

def set_options(options)
  TstLog("Empty set_options: #{options[:reg_options].inspect}");
  # do nothing
  self
end