Sha256: a1915368d516e2434d4b3421e3529811d1630cfaa19cf748797c14cfbfab1587

Contents?: true

Size: 505 Bytes

Versions: 8

Compression:

Stored size: 505 Bytes

Contents

# frozen_string_literal: true

require_relative 'variable'

module Coactive
  module Initializers
    module Contexts
      extend ActiveSupport::Concern

      included do
        class_attribute :_contexts
        self._contexts = []
      end

      class_methods do
        def context(*names, **options)
          self._contexts = _contexts.reject { |var| names.include?(var.name) }
          self._contexts += names.map { |name| Variable.new(name, options) }
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
coactive-0.6.0 lib/coactive/initializers/contexts.rb
coactive-0.5.2 lib/coactive/initializers/contexts.rb
coactive-0.5.1 lib/coactive/initializers/contexts.rb
coactive-0.5.0 lib/coactive/initializers/contexts.rb
coactive-0.4.1 lib/coactive/initializers/contexts.rb
coactive-0.4.0 lib/coactive/initializers/contexts.rb
coactive-0.3.0 lib/coactive/initializers/contexts.rb
coactive-0.2.2 lib/coactive/initializers/contexts.rb