Class: DSN::Subcode::Base
- Inherits:
-
Object
- Object
- DSN::Subcode::Base
show all
- Defined in:
- lib/dsn/subcode/base.rb
Overview
Shared behaviour for subcodes.
Instance Method Summary
collapse
Constructor Details
#initialize(status_code) ⇒ Base
Returns a new instance of Base.
7
8
9
|
# File 'lib/dsn/subcode/base.rb', line 7
def initialize(status_code)
@status_code = status_code
end
|
Instance Method Details
#to_i ⇒ Object
21
22
23
24
25
|
# File 'lib/dsn/subcode/base.rb', line 21
def to_i
Integer(significant_parts.last)
rescue ArgumentError
raise InvalidSubcode
end
|
#to_s ⇒ Object
17
18
19
|
# File 'lib/dsn/subcode/base.rb', line 17
def to_s
filename
end
|
#valid? ⇒ Boolean
11
12
13
14
15
|
# File 'lib/dsn/subcode/base.rb', line 11
def valid?
File.exist?(filepath)
rescue InvalidSubcode
false
end
|