Sha256: bb6958b4ebdb4f6be85f7765ee0e652b5b3eb787eb55da25df25c6c97495dc90
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
module Symbiont module Factory # Creates a definition context for actions. # # @param [Class] definition The name of a definition class # @param [optional] block Logic to execute within the context of the # definition # @return [Object] instance of the definition def on(definition, visit=false, &block) definition = get_object_for(definition) if definition.is_a? String @active = definition.new(@browser, visit) block.call @active if block @active end # Creates a definition context for actions and establishes the # context for display. # # @param [Class] definition The name of a definition class # @param [optional] block Logic to execute within the context of the # definition # @return [Object] instance of the definition def on_view(definition, &block) on(definition, true, &block) end def if_on(definition, &block) definition = get_object_for(definition) if definition.is_a? String return @active unless @active.class == definition on(definition, false, &block) end alias_method :during, :on alias_method :start_activity, :on_view alias_method :start_on, :on_view private def get_object_for(definition) definition.split('::').inject(Object) do |obj, name| obj.const_get(name) end end end # module: Factory end # module: Symbiont
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
symbiont-0.2.1 | lib/symbiont/factory.rb |
symbiont-0.2.0 | lib/symbiont/factory.rb |