Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/extensions/string.rb,
lib/checker/css.rb
Instance Method Summary collapse
- #comma_separated_words ⇒ Object
-
#css_values ⇒ Object
Avoids properties like rgb(5, 10, 15) to be split.
- #escape_html ⇒ Object
- #get_extension ⇒ Object
- #get_string_between_markers(starter, ender) ⇒ Object
- #remove_string_between_markers(starter, ender) ⇒ Object
Instance Method Details
#comma_separated_words ⇒ Object
25 26 27 |
# File 'lib/checker/css.rb', line 25 def comma_separated_words split(',').map(&:strip) end |
#css_values ⇒ Object
Avoids properties like rgb(5, 10, 15) to be split
21 22 23 |
# File 'lib/checker/css.rb', line 21 def css_values scan /[^\s]+\(\s*\g<0>\s*(?:,\s*\g<0>)*\)|[^\s]+/ end |
#escape_html ⇒ Object
2 3 4 |
# File 'lib/extensions/string.rb', line 2 def escape_html ERB::Util.html_escape self end |
#get_extension ⇒ Object
6 7 8 |
# File 'lib/extensions/string.rb', line 6 def get_extension self.split('.').last end |
#get_string_between_markers(starter, ender) ⇒ Object
29 30 31 |
# File 'lib/checker/css.rb', line 29 def get_string_between_markers(starter, ender) self[/#{Regexp.escape(starter)}(.*?)#{Regexp.escape(ender)}/m, 1] end |
#remove_string_between_markers(starter, ender) ⇒ Object
33 34 35 |
# File 'lib/checker/css.rb', line 33 def remove_string_between_markers(starter, ender) gsub(/#{starter}.*#{ender}/, '') end |