Module: Deprecations
- Defined in:
- lib/deprecations.rb,
lib/deprecations/version.rb,
lib/deprecations/behavior.rb,
lib/deprecations/extension.rb
Defined Under Namespace
Modules: ClassMethods, Helper, InstanceMethods, Raise, Warn
Constant Summary
collapse
- VERSION =
'2.0.2'
Class Method Summary
collapse
Class Method Details
.behavior ⇒ Object
4
5
6
|
# File 'lib/deprecations/behavior.rb', line 4
def behavior
BEHAVIOR.key(@behavior) || @behavior
end
|
.behavior=(behavior) ⇒ Object
8
9
10
|
# File 'lib/deprecations/behavior.rb', line 8
def behavior=(behavior)
@behavior = as_behavior(behavior)
end
|
.call(subject, alternative, outdated) ⇒ Object
6
7
8
9
|
# File 'lib/deprecations.rb', line 6
def self.call(subject, alternative, outdated)
@behavior.call(subject, alternative, outdated)
self
end
|
.set_behavior(behavior) ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/deprecations/behavior.rb', line 12
def set_behavior(behavior)
behavior = as_behavior(behavior)
block_given? or raise(ArgumentError, 'block expected')
current_behavior = @behavior
begin
@behavior = behavior
yield
ensure
@behavior = current_behavior
end
end
|