Sha256: 750e3ea0925cb0461612b9299f42070a9bb3782989c27eb590b6c86862843dfe

Contents?: true

Size: 761 Bytes

Versions: 5

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

# CurrencySelect
module ActionView
  module Helpers
    ##
    # Tag.
    #
    module ToCurrencySelectTag
      def to_currency_select_tag(priority_currencies, options, html_options)
        html_options = html_options.stringify_keys
        add_default_name_and_id(html_options)
        value = if method(:value).arity.zero?
                  options.fetch(:selected) { value() }
                else
                  options.fetch(:selected) { value(object) }
                end
        content_tag(
          'select',
          add_options(
            currency_options_for_select(value, priority_currencies),
            options,
            value
          ),
          html_options
        )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
currency_select-8.1.0 lib/to_currency_select_tag.rb
currency_select-8.0.0 lib/to_currency_select_tag.rb
currency_select-7.0.0 lib/to_currency_select_tag.rb
currency_select-6.0.0 lib/to_currency_select_tag.rb
currency_select-5.0.1 lib/to_currency_select_tag.rb