Sha256: bff5c6aec5e693ac77ff92a00f5733b8bcdb696b94cdc9b567102fb02355d186

Contents?: true

Size: 885 Bytes

Versions: 6

Compression:

Stored size: 885 Bytes

Contents

# encoding: utf-8

# Copyright (C) 2016 Mikio Ikoma

require 'regextest/common'

# Empty part
module Regextest::Front::Empty
  class TEmpty
    include Regextest::Common
    @@id = 0   # a class variable for generating unique name of element

    # Constructor
    def initialize
      TstLog("Empty: ")
      @offset = -1
      @length = 0
    end
    
    attr_reader :offset, :length
    
    # set options
    def set_options(options)
      TstLog("Empty set_options: #{options[:reg_options].inspect}");
      # do nothing
      self
    end
    
    # generate json format
    def json
      @@id += 1
        "{" +
           "\"type\": \"LEX_EMPTY\", \"id\": \"E#{@@id}\", \"value\": \"\", " +
           "\"offset\": #{@offset}, \"length\": #{@length}" +
        "}"
    end
  end
end

# Test suite (execute when this file is specified in command line)
if __FILE__ == $0 
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
regextest-0.1.8 lib/regextest/front/empty.rb
regextest-0.1.6 lib/regextest/front/empty.rb
regextest-0.1.5 lib/regextest/front/empty.rb
regextest-0.1.4 lib/regextest/front/empty.rb
regextest-0.1.3 lib/regextest/front/empty.rb
regextest-0.1.2 lib/regextest/front/empty.rb