Sha256: 0badf797e5784eecc650084f4aa9731ad8910e7d8d903a49f4f65b0d711a5505

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

module IronNails

  module View

    # Encapsulates commands that will be attached to elements in the views.
    class EventCommand < Command

      # the name of the event that will trigger the action
      attr_accessor :trigger

      # the name of the element that will trigger the action
      attr_accessor :element

      # the name of the on which this command needs to be invoked
      attr_accessor :affinity

      alias_method :nails_base_command_read_options, :read_options

      def read_options(options)
        nails_base_command_read_options options
        raise ArgumentException.new("An element name is necesary") if options[:element].nil?

        @trigger = options[:event]||:click
        @element = options[:element]
        @affinity = options[:affinity]
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ironnails-0.0.3 lib/ironnails/view/commands/event_command.rb
ironnails-0.0.1 lib/ironnails/view/commands/event_command.rb