Module: YoudaoFanyiAPI::Configuration
- Included in:
- YoudaoFanyiAPI
- Defined in:
- lib/youdao_fanyi_api/configuration.rb
Constant Summary collapse
- VALID_OPTIONS =
i[key keyfrom].freeze
- DEFAULT_OPTIONS =
i[type doctype version].freeze
- OPTIONS =
VALID_OPTIONS + DEFAULT_OPTIONS
- DEFAULT_TYPE =
'data'
- DEFAULT_DOCTYPE =
'json'
- DEFAULT_VERSION =
'1.1'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
12 13 14 |
# File 'lib/youdao_fanyi_api/configuration.rb', line 12 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
24 25 26 |
# File 'lib/youdao_fanyi_api/configuration.rb', line 24 def configure yield self end |
#options ⇒ Object
28 29 30 |
# File 'lib/youdao_fanyi_api/configuration.rb', line 28 def OPTIONS.collect { |key| [key, send(key)] }.to_h end |
#reset ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/youdao_fanyi_api/configuration.rb', line 16 def reset self.key = nil self.keyfrom = nil self.type = DEFAULT_TYPE self.doctype = DEFAULT_DOCTYPE self.version = DEFAULT_VERSION end |