Module: MovieRexx::Configuration

Included in:
MovieRexx
Defined in:
lib/movie_rexx/configuration.rb

Constant Summary collapse

VALID_OPTION_KEYS =
api_key base_url version include_adult language).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_keyObject

attr_accessor(*VALID_OPTION_KEYS)


6
7
8
# File 'lib/movie_rexx/configuration.rb', line 6

def api_key
  @api_key
end

#base_urlObject

attr_accessor(*VALID_OPTION_KEYS)


6
7
8
# File 'lib/movie_rexx/configuration.rb', line 6

def base_url
  @base_url
end

#include_adultObject

attr_accessor(*VALID_OPTION_KEYS)


6
7
8
# File 'lib/movie_rexx/configuration.rb', line 6

def include_adult
  @include_adult
end

#languageObject

attr_accessor(*VALID_OPTION_KEYS)


6
7
8
# File 'lib/movie_rexx/configuration.rb', line 6

def language
  @language
end

#versionObject

attr_accessor(*VALID_OPTION_KEYS)


6
7
8
# File 'lib/movie_rexx/configuration.rb', line 6

def version
  @version
end

Class Method Details

.keysObject


9
10
11
# File 'lib/movie_rexx/configuration.rb', line 9

def keys
  @keys ||= VALID_OPTION_KEYS
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:


14
15
16
# File 'lib/movie_rexx/configuration.rb', line 14

def configure
  yield self
end

#reset!Object

Reset configuration options to default values


19
20
21
22
23
24
# File 'lib/movie_rexx/configuration.rb', line 19

def reset!
  MovieRexx::Configuration.keys.each do |key|
    instance_variable_set(:"@#{key}", MovieRexx::Default.options[key])
  end
  self
end

#respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)

26
27
28
# File 'lib/movie_rexx/configuration.rb', line 26

def respond_to?(method, include_private=false)
  new.respond_to?(method, include_private) || super(method, include_private)
end