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