Class: Mangadex::Internal::Definitions::Year
- Defined in:
- lib/mangadex/internal/definitions/year.rb
Instance Attribute Summary
Attributes inherited from Base
#accepts, #converts, #errors, #key
Instance Method Summary collapse
-
#initialize(value) ⇒ Year
constructor
A new instance of Year.
- #validate_accepts ⇒ Object
Methods inherited from Base
#empty?, #error_message, #valid?, #validate, #validate!, #value
Constructor Details
#initialize(value) ⇒ Year
Returns a new instance of Year.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mangadex/internal/definitions/year.rb', line 7 def initialize(value) super( value, key: :year, accepts: Accepts.new( array: ["none"], class: Integer, condition: :or, ), required: false, ) end |
Instance Method Details
#validate_accepts ⇒ Object
20 21 22 23 24 |
# File 'lib/mangadex/internal/definitions/year.rb', line 20 def validate_accepts @accepts.validate!(converted_value) rescue ArgumentError => error add_error(error.) end |