diff options
| author | Paul Buetow <paul@buetow.org> | 2024-12-08 13:09:34 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-12-08 13:09:34 +0200 |
| commit | 5897262698ac68a85ad68b69f4f6aeb3171d399a (patch) | |
| tree | c142930276a262176f160d21abcb35ef698f9cad /lib/dslkeywords/only_when.rb | |
| parent | ed5f36ed3dffbac12247e5130e61d8ebd8ad82f5 (diff) | |
use of endless methods
Diffstat (limited to 'lib/dslkeywords/only_when.rb')
| -rw-r--r-- | lib/dslkeywords/only_when.rb | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/dslkeywords/only_when.rb b/lib/dslkeywords/only_when.rb index 2f493b2..82dbc1f 100644 --- a/lib/dslkeywords/only_when.rb +++ b/lib/dslkeywords/only_when.rb @@ -3,21 +3,10 @@ module RCM class OnlyWhen require 'socket' - def initialize - @conds = {} - end - - def is(arg) - arg - end - - def method_missing(method_name, *args, &block) - @conds[method_name] = args.first - end - - def respond_to_missing? - true - end + def initialize = @conds = {} + def is(arg) = arg + def method_missing(method_name, *args, &block) = @conds[method_name] = args.first + def respond_to_missing? = true def met? return false if @conds.key?(:hostname) && Socket.gethostname != @conds[:hostname].to_s |
