Sha256: da408ef50afbb8502c821480b78006a36bfcdee317a73fe2a4a07ea7fc9d3b67

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

module Cello
  module Structure
    module SelectHelper
      def define_extras_for_select(name)
        include LogHelper

        define_method "#{name}_get_options" do
          logger(name, __method__, :select) {
            options = Array.new
            send(name).options.each do |option|
              options.push option.text
            end
            options
          }
        end
        define_method "#{name}_select" do |option|
          logger(name, __method__, :select) {
            send(name).select option
          }
        end
        define_method "#{name}_is" do |option|
          logger(name, __method__, :select) {
            send(name).selected_options.last.text == option
          }
        end
        define_method "#{name}_selected" do
          logger(name, __method__, :select) {
            send(name).selected_options.last.text
          }
        end
      #  define_method "#{name}_clear" do
      #    send(name).clear
      #  end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cello-0.0.19 lib/cello/structure/html_elements/select_helper.rb