Class: String
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #color? ⇒ Boolean
- #color_with_alpha? ⇒ Boolean
- #dasherize ⇒ Object
- #to_hex_alpha ⇒ Object
- #to_hex_color ⇒ Object
Instance Method Details
#blank? ⇒ Boolean
19 20 21 |
# File 'lib/tm2gsv/extensions.rb', line 19 def blank? self.strip == "" end |
#color? ⇒ Boolean
23 24 25 26 27 28 29 |
# File 'lib/tm2gsv/extensions.rb', line 23 def color? if self.include? '#' and self.size > 6 return true end return false end |
#color_with_alpha? ⇒ Boolean
31 32 33 34 35 36 37 |
# File 'lib/tm2gsv/extensions.rb', line 31 def color_with_alpha? if self.include? '#' and self.size > 7 return true end return false end |
#dasherize ⇒ Object
47 48 49 |
# File 'lib/tm2gsv/extensions.rb', line 47 def dasherize self.downcase.gsub(/[^0-9A-Za-z]/, ' ').squeeze(' ').gsub(' ', '-').strip end |
#to_hex_alpha ⇒ Object
43 44 45 |
# File 'lib/tm2gsv/extensions.rb', line 43 def to_hex_alpha (100 * ((self[7,8]).to_i(16) / 255.0)).round end |
#to_hex_color ⇒ Object
39 40 41 |
# File 'lib/tm2gsv/extensions.rb', line 39 def to_hex_color self[0..6] end |