Class: Dao::Errors::KeyPrefixer

Inherits:
Object
  • Object
show all
Defined in:
lib/dao/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ KeyPrefixer

Returns a new instance of KeyPrefixer.



260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/dao/errors.rb', line 260

def initialize(object)
  @object = object

  @prefix =
    if @object && @object.respond_to?(:model_name)
      @object.model_name.to_s.underscore
    else
      nil
    end

  @global = Array(Global)
end

Instance Attribute Details

#globalObject

Returns the value of attribute global.



258
259
260
# File 'lib/dao/errors.rb', line 258

def global
  @global
end

#objectObject

Returns the value of attribute object.



256
257
258
# File 'lib/dao/errors.rb', line 256

def object
  @object
end

#prefix(key) ⇒ Object

Returns the value of attribute prefix.



257
258
259
# File 'lib/dao/errors.rb', line 257

def prefix
  @prefix
end