Sha256: 6f85c66dd69d13d71ef1b4c19bb9b83d1a6ccee070ab52e6204d2c15a0f58ab9
Contents?: true
Size: 757 Bytes
Versions: 1
Compression:
Stored size: 757 Bytes
Contents
module Kanal module Core module Conditions # This class helps creating conditions in dsl way, # with using helper methods class ConditionCreator def initialize(name) @name = name @met_block = nil @with_argument = false end def create(&block) instance_eval(&block) raise "Please provide name for condition" unless @name raise "Please provide met? block for condition #{@name}" unless @met_block Condition.new @name, with_argument: @with_argument, &@met_block end def with_argument @with_argument = true end def met?(&block) @met_block = block end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kanal-0.3.0 | lib/kanal/core/conditions/condition_creator.rb |