Class: JsonApiErrors::Error

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/json_api_errors/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template: JsonApiErrors::Templates::Default.new) ⇒ Error

Returns a new instance of Error.



31
32
33
# File 'lib/json_api_errors/error.rb', line 31

def initialize(template: JsonApiErrors::Templates::Default.new)
  @template = template
end

Instance Attribute Details

#templateObject

Returns the value of attribute template.



29
30
31
# File 'lib/json_api_errors/error.rb', line 29

def template
  @template
end

Instance Method Details

#callObject



35
36
37
# File 'lib/json_api_errors/error.rb', line 35

def call
  template.render
end

#status_codeObject



39
40
41
# File 'lib/json_api_errors/error.rb', line 39

def status_code
  template.status
end