Class: Errors::Base

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code = nil) ⇒ Base

Returns a new instance of Base.



11
12
13
14
# File 'lib/errors.rb', line 11

def initialize(code=nil)
  @code = code
  read_file
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



9
10
11
# File 'lib/errors.rb', line 9

def data
  @data
end

Instance Method Details

#codeObject



20
21
22
# File 'lib/errors.rb', line 20

def code
  @code
end

#descriptionObject



28
29
30
# File 'lib/errors.rb', line 28

def description
  result['description']
end

#phraseObject



24
25
26
# File 'lib/errors.rb', line 24

def phrase
  result['phrase']
end

#read_fileObject



16
17
18
# File 'lib/errors.rb', line 16

def read_file
  @data = JSON.parse(File.read("#{Dir.pwd}/lib/json/status-codes.json"))
end

#spec_hrefObject



36
37
38
# File 'lib/errors.rb', line 36

def spec_href
  result['spec_href']
end

#spec_titleObject



32
33
34
# File 'lib/errors.rb', line 32

def spec_title
  result['spec_title']
end