# encoding: utf-8 module Hexx # @api hide # The module contains classes that defines helper methods for the service. # # Basically those methods are private inside the service. In the helper # they are public, allowing them to be testable as a part of the gem's API. module Helpers # @api hide # The module declares helper methods for managing service object's params. module Parameters extend ActiveSupport::Concern # @api hide # Class helper methods module ClassMethods def allow_params(*keys) @params = keys.flatten.map(&:to_s) fail ArgumentError if @params == [] params.each { |name| Creators::Parameter.add self, name } end private def params @params ||= [] end end attr_reader :params def initialize(params = {}) @params = params.stringify_keys.slice(*class_params) end private def class_params @class_params ||= self.class.send :params end end end end