Sha256: 2d11f7bd07e48213906773f114953b7e223174efb1bb699665324e2523a1eb2e

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

class Kookaburra
  class UIDriver
    # Classes that can contain reerences to {UIComponent} instances
    # (i.e. {UIDriver} and {UIDriver::UIComponent} subclasses are
    # extended by this module in order to set up those references.
    # {UIDriver} and {UIComponent} are already extended, so you
    # shouldn't need to do so elsewhere.
    #
    # Instances of the extending class must define a {#configuration}
    # method that returns the current Kookaburra::Configuration
    module HasUIComponents

      # Tells the extending UIDriver or UIComponent about your {UIComponent} subclasses.
      #
      # @param [Symbol] component_name Will create an instance method of this
      #   name that returns an instance of the component_class
      # @param [Class] component_class The {UIComponent} subclass that defines
      #   this component.
      # @param [Hash] options An extra options hash that will be passed
      #   to the {UIComponent} on initialization.
      def ui_component(component_name, component_class, options = {})
        define_method(component_name) do
          component_class.new(configuration, options)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kookaburra-3.0.1 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-3.0.0 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-2.0.0 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-1.3.1 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-1.3.0 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-1.2.3 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-1.2.2 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-1.2.1 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-1.2.0 lib/kookaburra/ui_driver/has_ui_components.rb