Class: StrongConcerns::Intermediate
- Inherits:
-
Object
- Object
- StrongConcerns::Intermediate
show all
- Extended by:
- Forwardable
- Defined in:
- lib/strong_concerns/intermediate.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(subject, options) ⇒ Intermediate
Returns a new instance of Intermediate.
34
35
36
37
38
|
# File 'lib/strong_concerns/intermediate.rb', line 34
def initialize(subject, options)
@__subject__ = subject
@options = options
@active = false
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth) ⇒ Object
40
41
42
|
# File 'lib/strong_concerns/intermediate.rb', line 40
def method_missing(meth)
raise NameError.new("Looks like you not list method <#{meth}> in self.require_methods of concern or misspelled it")
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
16
17
18
|
# File 'lib/strong_concerns/intermediate.rb', line 16
def options
@options
end
|
Class Method Details
.prepare(mod) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/strong_concerns/intermediate.rb', line 8
def self.prepare(mod)
Class.new(Intermediate).tap do |kls|
kls.send(:include, mod)
meths = mod.require_methods
kls.def_delegators :@__subject__, *meths
end
end
|
Instance Method Details
#activate ⇒ Object
18
19
20
|
# File 'lib/strong_concerns/intermediate.rb', line 18
def activate
@active = true
end
|
#active? ⇒ Boolean
26
27
28
|
# File 'lib/strong_concerns/intermediate.rb', line 26
def active?
@active
end
|
#inactivate ⇒ Object
22
23
24
|
# File 'lib/strong_concerns/intermediate.rb', line 22
def inactivate
@active = false
end
|
#inactive? ⇒ Boolean
30
31
32
|
# File 'lib/strong_concerns/intermediate.rb', line 30
def inactive?
not active?
end
|
#inspect ⇒ Object
44
45
46
|
# File 'lib/strong_concerns/intermediate.rb', line 44
def inspect
"Intermediate<#{self.methods}>"
end
|