Module: Artwork::Configuration
- Included in:
- Artwork
- Defined in:
- lib/artwork/configuration.rb
Instance Method Summary collapse
- #actual_resolution ⇒ Object
- #actual_resolution=(resolution) ⇒ Object
- #base_resolution ⇒ Object
- #base_resolution=(resolution) ⇒ Object
- #configure_for(request) ⇒ Object
- #current_resolution ⇒ Object
- #current_resolution=(resolution) ⇒ Object
- #load_2x_images=(flag) ⇒ Object
- #load_2x_images? ⇒ Boolean
- #reset_configuration ⇒ Object
- #supported_resolutions_list ⇒ Object
- #supported_resolutions_list=(resolutions) ⇒ Object
Instance Method Details
#actual_resolution ⇒ Object
39 40 41 |
# File 'lib/artwork/configuration.rb', line 39 def actual_resolution get(:actual_resolution) || base_resolution end |
#actual_resolution=(resolution) ⇒ Object
43 44 45 |
# File 'lib/artwork/configuration.rb', line 43 def actual_resolution=(resolution) set :actual_resolution, resolution end |
#base_resolution ⇒ Object
14 15 16 |
# File 'lib/artwork/configuration.rb', line 14 def base_resolution get(:base_resolution) or @@base_resolution or raise "Please set #{__method__}" end |
#base_resolution=(resolution) ⇒ Object
18 19 20 21 |
# File 'lib/artwork/configuration.rb', line 18 def base_resolution=(resolution) @@base_resolution ||= resolution set :base_resolution, resolution end |
#configure_for(request) ⇒ Object
47 48 49 50 51 |
# File 'lib/artwork/configuration.rb', line 47 def configure_for(request) Artwork.load_2x_images = fetch_2x_images_flag_from(request) Artwork.current_resolution = current_resolution_from(request) Artwork.actual_resolution = actual_resolution_from(request) end |
#current_resolution ⇒ Object
31 32 33 |
# File 'lib/artwork/configuration.rb', line 31 def current_resolution get(:current_resolution) || base_resolution end |
#current_resolution=(resolution) ⇒ Object
35 36 37 |
# File 'lib/artwork/configuration.rb', line 35 def current_resolution=(resolution) set :current_resolution, resolution end |
#load_2x_images=(flag) ⇒ Object
27 28 29 |
# File 'lib/artwork/configuration.rb', line 27 def load_2x_images=(flag) set :load_2x_images, flag end |
#load_2x_images? ⇒ Boolean
23 24 25 |
# File 'lib/artwork/configuration.rb', line 23 def load_2x_images? get(:load_2x_images) || false end |
#reset_configuration ⇒ Object
53 54 55 56 |
# File 'lib/artwork/configuration.rb', line 53 def reset_configuration set :current_resolution, nil set :load_2x_images, nil end |
#supported_resolutions_list ⇒ Object
3 4 5 |
# File 'lib/artwork/configuration.rb', line 3 def supported_resolutions_list get(:supported_resolutions_list) or @@supported_resolutions_list or raise "Please set #{__method__}" end |
#supported_resolutions_list=(resolutions) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/artwork/configuration.rb', line 7 def supported_resolutions_list=(resolutions) list = resolutions.map(&:to_i).sort @@supported_resolutions_list ||= list set :supported_resolutions_list, list end |