Class: RBlade::StyleManager
- Inherits:
-
Object
- Object
- RBlade::StyleManager
- Defined in:
- lib/rblade/helpers/style_manager.rb
Instance Method Summary collapse
-
#initialize(styles) ⇒ StyleManager
constructor
A new instance of StyleManager.
- #to_s ⇒ Object
Constructor Details
#initialize(styles) ⇒ StyleManager
Returns a new instance of StyleManager.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rblade/helpers/style_manager.rb', line 3 def initialize styles if styles.is_a? String @styles = styles.strip unless @styles == "" || @styles.end_with?(";") @styles << ";" end elsif styles.is_a? Array @styles = styles.map do |style| style = style.strip unless style.end_with? ";" style << ";" end style end.join elsif styles.is_a? Hash @styles = "" styles.each do |value, predicate| if predicate value = value.to_s.strip unless value.end_with? ";" value << ";" end @styles << value end end end end |
Instance Method Details
#to_s ⇒ Object
33 34 35 |
# File 'lib/rblade/helpers/style_manager.rb', line 33 def to_s @styles end |