Module: Concerned

Defined in:
lib/concerned.rb

Defined Under Namespace

Modules: MetaMethods

Class Method Summary collapse

Class Method Details

.extend_disable!Object



46
47
48
# File 'lib/concerned.rb', line 46

def extend_disable!
  @extend_enabled = false
end

.extend_enable!Object



42
43
44
# File 'lib/concerned.rb', line 42

def extend_enable!
  @extend_enabled = true
end

.extend_enabled?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/concerned.rb', line 50

def extend_enabled?
  @extend_enabled
end

.included(base) ⇒ Object



4
5
6
# File 'lib/concerned.rb', line 4

def self.included(base)
  base.extend MetaMethods
end

.require_shared(concern) ⇒ Object



25
26
27
# File 'lib/concerned.rb', line 25

def require_shared concern
  require_method "shared/#{concern.to_s.underscore}"
end

.shared_const(concern_ns) ⇒ Object



29
30
31
32
33
# File 'lib/concerned.rb', line 29

def shared_const concern_ns
  concern_ns.constantize
rescue NameError
  shared_ns_const concern_ns
end

.shared_ns_const(concern_ns) ⇒ Object



35
36
37
38
39
40
# File 'lib/concerned.rb', line 35

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