Sha256: 52b5f2c720a8b39de6d8432f3de3aa5c2a6d69a62658d444d240fa64ebde5274

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

module Attentive
  module Tokens

    def any_of(string, possibilities, pos: nil)
      Attentive::Tokens::AnyOf.new string, possibilities, pos
    end

    def emoji(string, pos: nil)
      Attentive::Tokens::Emoji.new string, pos
    end

    def entity(string, pos: nil)
      entity_name, variable_name = *string.split(":").reverse
      Attentive::Entity[entity_name.to_sym].new(variable_name || entity_name)
    end

    def invocation(string, pos: nil)
      Attentive::Tokens::Invocation.new string, pos
    end

    def punctuation(string, pos: nil)
      Attentive::Tokens::Punctuation.new string, pos
    end

    def regexp(string, pos: nil)
      Attentive::Tokens::Regexp.new string, pos
    end

    def whitespace(string, pos: nil)
      Attentive::Tokens::Whitespace.new string, pos
    end

    def word(string, pos: nil)
      Attentive::Tokens::Word.new string, pos
    end

  end
end

require "attentive/tokens/any_of"
require "attentive/tokens/emoji"
require "attentive/tokens/invocation"
require "attentive/tokens/punctuation"
require "attentive/tokens/regexp"
require "attentive/tokens/whitespace"
require "attentive/tokens/word"

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
attentive-0.3.9 lib/attentive/tokens.rb
attentive-0.3.8 lib/attentive/tokens.rb
attentive-0.3.7 lib/attentive/tokens.rb
attentive-0.3.6 lib/attentive/tokens.rb
attentive-0.3.5 lib/attentive/tokens.rb
attentive-0.3.4 lib/attentive/tokens.rb
attentive-0.3.3 lib/attentive/tokens.rb
attentive-0.3.2 lib/attentive/tokens.rb
attentive-0.3.1 lib/attentive/tokens.rb
attentive-0.3.0 lib/attentive/tokens.rb