Sha256: 2c4d9b54063b3b7cbaa7db28f32e10d2d3124523e4d6cc8561373631c0d71919

Contents?: true

Size: 795 Bytes

Versions: 15

Compression:

Stored size: 795 Bytes

Contents

# frozen_string_literal: true

module PriceHubble
  module EntityConcern
    module Attributes
      # A separated string inquirer typed attribute helper.
      module StringInquirer
        extend ActiveSupport::Concern

        class_methods do
          # Register a casted string inquirer attribute.
          #
          # @param name [Symbol, String] the name of the attribute
          # @param _args [Hash{Symbol => Mixed}] additional options
          def typed_attr_string_inquirer(name, **_args)
            class_eval <<-RUBY, __FILE__, __LINE__ + 1
              def #{name}=(value)
                #{name}_will_change!
                @#{name} = ActiveSupport::StringInquirer.new(value.to_s)
              end
            RUBY
          end
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
pricehubble-1.3.0 lib/price_hubble/entity/concern/attributes/string_inquirer.rb
pricehubble-1.2.5 lib/price_hubble/entity/concern/attributes/string_inquirer.rb
pricehubble-1.2.4 lib/price_hubble/entity/concern/attributes/string_inquirer.rb
pricehubble-1.2.3 lib/price_hubble/entity/concern/attributes/string_inquirer.rb
pricehubble-1.2.2 lib/price_hubble/entity/concern/attributes/string_inquirer.rb
pricehubble-1.2.1 lib/price_hubble/entity/concern/attributes/string_inquirer.rb
pricehubble-1.2.0 lib/price_hubble/entity/concern/attributes/string_inquirer.rb
pricehubble-1.1.0 lib/pricehubble/entity/concern/attributes/string_inquirer.rb
pricehubble-1.0.0 lib/pricehubble/entity/concern/attributes/string_inquirer.rb
pricehubble-0.4.2 lib/pricehubble/entity/concern/attributes/string_inquirer.rb
pricehubble-0.4.1 lib/pricehubble/entity/concern/attributes/string_inquirer.rb
pricehubble-0.4.0 lib/pricehubble/entity/concern/attributes/string_inquirer.rb
pricehubble-0.3.0 lib/pricehubble/entity/concern/attributes/string_inquirer.rb
pricehubble-0.2.0 lib/pricehubble/entity/concern/attributes/string_inquirer.rb
pricehubble-0.1.0 lib/pricehubble/entity/concern/attributes/string_inquirer.rb