Sha256: 74b8a80eb1f9d94b59f6fffa1ec6b5cda4da866755183a4fd908b2deb20e4931

Contents?: true

Size: 1 KB

Versions: 17

Compression:

Stored size: 1 KB

Contents

module Aio::Parse

  require "aio/core/parse/parser_machine/parent_state"
  require "aio/core/parse/parser_machine/no_device_state"
  require "aio/core/parse/parser_machine/has_device_state"
  require "aio/core/parse/parser_machine/full_state"

  class ParserMachine
    # 保存状态机的状态
    attr_reader :state

    # device_manager
    attr_reader :device_manager

    def initialize(device_manager)
      @device_manager = device_manager

      @no_device_state 	= Aio::Parse::NoDeviceState.new(self)
      @has_device_state	= Aio::Parse::HasDeviceState.new(self)
      @full_state				= Aio::Parse::FullState.new(self)

      @state = @no_device_state
    end

    def get_device(opts)
      @state.get_device(opts)
    end

    def get_full(opts)
      @state.get_full(opts)
    end

    # 状态的切换
    def to_no_device_state
      @state = @no_device_state
    end

    def to_has_device_state
      @state = @has_device_state
    end

    def to_full_state
      @state = @full_state
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
aio_elin-1.1.8 lib/aio/core/parse/parser_machine.rb
aio_elin-1.1.7 lib/aio/core/parse/parser_machine.rb
aio_elin-1.1.4 lib/aio/core/parse/parser_machine.rb
aio_elin-1.1.3 lib/aio/core/parse/parser_machine.rb
aio_elin-1.1.2 lib/aio/core/parse/parser_machine.rb
aio_elin-1.1.1 lib/aio/core/parse/parser_machine.rb
aio_elin-1.1.0 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.9 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.8 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.7 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.6 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.5 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.4 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.3 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.2 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.1 lib/aio/core/parse/parser_machine.rb
aio_elin-1.0.0 lib/aio/core/parse/parser_machine.rb