Sha256: bb4c4529e755c317f5fe4d127567f3e1871145c6de72b3bfca8bfcf89631e428

Contents?: true

Size: 758 Bytes

Versions: 10

Compression:

Stored size: 758 Bytes

Contents

require "attentive/trie"

module Attentive
  module Config

    attr_reader :invocations
    attr_accessor :default_required_contexts
    attr_accessor :default_prohibited_contexts

    def invocations=(*values)
      remove_instance_variable :@substitutions if defined?(@substitutions)
      @invocations = values.flatten
    end

    def substitutions
      return @substitutions if defined?(@substitutions)
      @substitutions = Attentive::Trie.of_substitutions(
        Attentive::SUBSTITUTIONS.merge(
          invocations.each_with_object({}) { |invocation, hash|
            tokens = Attentive.tokenize(invocation, substitutions: false)
            hash[tokens] = [Attentive::Tokens::Invocation.new(invocation, 0)]
          } ) )
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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