Class: Browsernizer::Config
- Inherits:
-
Object
- Object
- Browsernizer::Config
- Defined in:
- lib/browsernizer/config.rb
Instance Method Summary collapse
- #exclude(path) ⇒ Object
- #excluded?(path) ⇒ Boolean
- #get_location ⇒ Object
- #get_supported ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #location(path) ⇒ Object
- #supported(*args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
4 5 6 7 8 9 |
# File 'lib/browsernizer/config.rb', line 4 def initialize @supported = [] @location = nil @exclusions = [] @handler = lambda { } end |
Instance Method Details
#exclude(path) ⇒ Object
25 26 27 |
# File 'lib/browsernizer/config.rb', line 25 def exclude(path) @exclusions << path end |
#excluded?(path) ⇒ Boolean
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/browsernizer/config.rb', line 37 def excluded?(path) @exclusions.any? do |exclusion| case exclusion when String exclusion == path when Regexp exclusion =~ path end end end |
#get_location ⇒ Object
33 34 35 |
# File 'lib/browsernizer/config.rb', line 33 def get_location @location end |
#get_supported ⇒ Object
29 30 31 |
# File 'lib/browsernizer/config.rb', line 29 def get_supported @supported end |
#location(path) ⇒ Object
21 22 23 |
# File 'lib/browsernizer/config.rb', line 21 def location(path) @location = path end |
#supported(*args, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/browsernizer/config.rb', line 11 def supported(*args, &block) if args.length == 2 @supported << Browser.new(args[0], args[1]) elsif block_given? @supported << block else raise ArgumentError, "accepts either (browser, version) or block" end end |