class Payanyway::Helpers::Settings

Public Class Methods

new(settings) click to toggle source
# File lib/payanyway/helpers/settings.rb, line 12
def initialize(settings)
  @settings = HashWithIndifferentAccess.new(settings.invert)
end

Public Instance Methods

configure_by(hash) click to toggle source

Выбирает из настроек нужные и подставляет в переданный hash

@settings = { 'MNT_ID' => :id, 'MNT_CURRENCY' => :currency }
hash = { id: 1 }
=> { 'MNT_ID': 1 }
# File lib/payanyway/helpers/settings.rb, line 22
def configure_by(hash)
  hash.each_with_object({}) do |(key, value), memo|
    memo[ @settings[key] ] = value if @settings.has_key?(key)
  end
end