Sha256: 794813ed5fd1a80881a6fdb47a670bdce413519aef86e2b9de0bbe5c22c5dfc6

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

module Fluent
  module Factory

    # Creates a definition context for actions.
    #
    # @param definition [Class] the name of a definition class
    # @param block [Proc] logic to execute within the context of the definition
    # @return [Object] instance of the definition
    def on(definition, visit=false, &block)
      return @active if @active.kind_of?(definition)
      @active = definition.new(@browser, visit)
      block.call @active if block
      @active
    end

    alias_method :on_page, :on
    alias_method :while_on, :on

    # Creates a definition context for actions and establishes the
    # context for display.
    #
    # @param definition [Class] the name of a definition class
    # @param block [Proc] logic to execute within the context of the definition
    def on_view(definition, &block)
      on(definition, true, &block)
    end

    alias_method :on_visit, :on_view
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-0.2.0 lib/fluent/factory.rb