Sha256: d8af0e650173bc8e672ce8e7accdb7c407fb85a9d2f5f405e43cd2673e2a05cf
Contents?: true
Size: 789 Bytes
Versions: 2
Compression:
Stored size: 789 Bytes
Contents
# frozen_string_literal: true module PriceHubble module Concern 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pricehubble-1.5.1 | lib/price_hubble/entity/concern/attributes/string_inquirer.rb |
pricehubble-1.5.0 | lib/price_hubble/entity/concern/attributes/string_inquirer.rb |