Sha256: 61667a2b54af3d5d01e64ac6393d8d67400922778626e16b815cf9e8490eab7d

Contents?: true

Size: 669 Bytes

Versions: 24

Compression:

Stored size: 669 Bytes

Contents

# frozen_string_literal: true

module Metatron
  module Templates
    module Concerns
      # Makes supporting namespaced resources easier
      module Namespaced
        def self.included(base)
          # base.extend ClassMethods
          base.class_eval do
            attr_accessor :namespace

            initializer :namespaced_initialize
          end
        end

        def namespaced_initialize
          @namespace = nil
        end

        def formatted_namespace
          if namespace
            { namespace: namespace.is_a?(Namespace) ? namespace.name : namespace }
          else
            {}
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
metatron-0.8.2 lib/metatron/templates/concerns/namespaced.rb
metatron-0.8.0 lib/metatron/templates/concerns/namespaced.rb
metatron-0.7.0 lib/metatron/templates/concerns/namespaced.rb
metatron-0.6.1 lib/metatron/templates/concerns/namespaced.rb
metatron-0.6.0 lib/metatron/templates/concerns/namespaced.rb
metatron-0.5.0 lib/metatron/templates/concerns/namespaced.rb
metatron-0.4.2 lib/metatron/templates/concerns/namespaced.rb
metatron-0.4.1 lib/metatron/templates/concerns/namespaced.rb
metatron-0.4.0 lib/metatron/templates/concerns/namespaced.rb
metatron-0.3.4 lib/metatron/templates/concerns/namespaced.rb
metatron-0.3.3 lib/metatron/templates/concerns/namespaced.rb
metatron-0.3.2 lib/metatron/templates/concerns/namespaced.rb
metatron-0.3.1 lib/metatron/templates/concerns/namespaced.rb
metatron-0.3.0 lib/metatron/templates/concerns/namespaced.rb
metatron-0.2.8 lib/metatron/templates/concerns/namespaced.rb
metatron-0.2.7 lib/metatron/templates/concerns/namespaced.rb
metatron-0.2.6 lib/metatron/templates/concerns/namespaced.rb
metatron-0.2.5 lib/metatron/templates/concerns/namespaced.rb
metatron-0.2.4 lib/metatron/templates/concerns/namespaced.rb
metatron-0.2.3 lib/metatron/templates/concerns/namespaced.rb