Class: CanIUse::Feature

Inherits:
Object
  • Object
show all
Defined in:
lib/can_i_use/feature.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Feature

Returns a new instance of Feature.



6
7
8
# File 'lib/can_i_use/feature.rb', line 6

def initialize(name)
  @name = name
end

Instance Method Details

#browsersObject




12
13
14
15
# File 'lib/can_i_use/feature.rb', line 12

def browsers
  return [] unless feature_data
  feature_data.fetch('stats', {}).inject([]) { |res, h| res << Browser.new(*h) }
end

#for_browser(name) ⇒ Object



17
18
19
# File 'lib/can_i_use/feature.rb', line 17

def for_browser(name)
  browsers.detect { |b| b.is?(name) }
end