Method: ActiveEntity::AMAttributeMethods::ClassMethods::AttributeMethodMatcher#initialize

Defined in:
lib/active_entity/attribute_methods.rb

#initialize(options = {}) ⇒ AttributeMethodMatcher

Returns a new instance of AttributeMethodMatcher.



378
379
380
381
382
383
# File 'lib/active_entity/attribute_methods.rb', line 378

def initialize(options = {})
  @prefix, @suffix = options.fetch(:prefix, ""), options.fetch(:suffix, "")
  @regex = /^(?:#{Regexp.escape(@prefix)})(.*)(?:#{Regexp.escape(@suffix)})$/
  @target = "#{@prefix}attribute#{@suffix}"
  @method_name = "#{prefix}%s#{suffix}"
end