Class: Mangadex::Config
Instance Attribute Summary collapse
-
#default_content_ratings ⇒ Object
Returns the value of attribute default_content_ratings.
-
#mangadex_url ⇒ Object
Returns the value of attribute mangadex_url.
-
#storage_class ⇒ Object
Returns the value of attribute storage_class.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #storage ⇒ Object
- #user_class=(klass) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
18 19 20 21 22 |
# File 'lib/config.rb', line 18 def initialize @storage_class = Storage::Memory @default_content_ratings = ContentRating.parse(['safe', 'suggestive', 'erotica']) @mangadex_url = 'https://api.mangadex.org' end |
Instance Attribute Details
#default_content_ratings ⇒ Object
Returns the value of attribute default_content_ratings.
12 13 14 |
# File 'lib/config.rb', line 12 def @default_content_ratings end |
#mangadex_url ⇒ Object
Returns the value of attribute mangadex_url.
15 16 17 |
# File 'lib/config.rb', line 15 def mangadex_url @mangadex_url end |
#storage_class ⇒ Object
Returns the value of attribute storage_class.
9 10 11 |
# File 'lib/config.rb', line 9 def storage_class @storage_class end |
Instance Method Details
#storage ⇒ Object
44 45 46 |
# File 'lib/config.rb', line 44 def storage @storage ||= storage_class.new end |
#user_class=(klass) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/config.rb', line 25 def user_class=(klass) missing_methods = [:session, :refresh, :mangadex_user_id] - klass.new.methods if missing_methods.empty? @user_class = klass else raise ArgumentError, 'user_class must respond to :session, :refresh, :mangadex_user_id' end end |