Class: CssParser::Parser
- Inherits:
-
Object
- Object
- CssParser::Parser
- Defined in:
- lib/checker/css.rb
Instance Method Summary collapse
Instance Method Details
#dig(*keys) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/checker/css.rb', line 2 def dig(*keys) media = parse_media(keys) selectors = get_selectors(keys) selectors.unshift(media) to_h(media).dig(*selectors) rescue {} end |
#get_selectors(keys) ⇒ Object
14 15 16 |
# File 'lib/checker/css.rb', line 14 def get_selectors(keys) keys.map { |k| k.remove_string_between_markers('@media_start', '@media_end:') } end |
#parse_media(keys) ⇒ Object
9 10 11 12 |
# File 'lib/checker/css.rb', line 9 def parse_media(keys) media = keys.map { |k| k.get_string_between_markers('@media_start', '@media_end') } media.first || 'all' end |