Class: Errors::Base
- Inherits:
-
Object
- Object
- Errors::Base
- Defined in:
- lib/errors.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #code ⇒ Object
- #description ⇒ Object
-
#initialize(code = nil) ⇒ Base
constructor
A new instance of Base.
- #phrase ⇒ Object
- #read_file ⇒ Object
- #spec_href ⇒ Object
- #spec_title ⇒ Object
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
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/errors.rb', line 9 def data @data end |
Instance Method Details
#code ⇒ Object
20 21 22 |
# File 'lib/errors.rb', line 20 def code @code end |
#description ⇒ Object
28 29 30 |
# File 'lib/errors.rb', line 28 def description result['description'] end |
#phrase ⇒ Object
24 25 26 |
# File 'lib/errors.rb', line 24 def phrase result['phrase'] end |
#read_file ⇒ Object
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_href ⇒ Object
36 37 38 |
# File 'lib/errors.rb', line 36 def spec_href result['spec_href'] end |
#spec_title ⇒ Object
32 33 34 |
# File 'lib/errors.rb', line 32 def spec_title result['spec_title'] end |