Sha256: cb52b56262c8d3ebda8d8d6dfbd4328c2e7ca747ae3934bf499fc2d1842d8789

Contents?: true

Size: 685 Bytes

Versions: 2

Compression:

Stored size: 685 Bytes

Contents

require 'concerned/module_ext'

module Concerned
  class << self
    def require_shared concern
      require_method "shared/#{concern.to_s.underscore}"
    end

    def shared_const concern_ns
      concern_ns.constantize
    rescue NameError
      shared_ns_const concern_ns
    end

    def shared_ns_const concern_ns
      const_name = "Shared::#{concern_ns}"
      const_name.constantize
    rescue NameError
      raise "No module could be found for: #{concern_ns} or #{const_name}"
    end

    def extend_enable!
      @extend_enabled = true
    end

    def extend_disable!
      @extend_enabled = false
    end

    def extend_enabled?
      @extend_enabled
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
concerned-0.1.1 lib/concerned.rb
concerned-0.1.0 lib/concerned.rb