Sha256: c7d99d1210c0805fbcb40163611b0958152db65030b6c5767d280ac0dd76d933

Contents?: true

Size: 1.15 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
kookaburra-1.1.0 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-1.0.0 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-0.27.0 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-0.26.1 lib/kookaburra/ui_driver/has_ui_components.rb
kookaburra-0.26.0 lib/kookaburra/ui_driver/has_ui_components.rb