Class: MotionStylez::Base
Instance Attribute Summary collapse
-
#selector ⇒ Object
Returns the value of attribute selector.
-
#stylesheet ⇒ Object
Returns the value of attribute stylesheet.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#selector ⇒ Object
Returns the value of attribute selector.
3 4 5 |
# File 'lib/motion-stylez/base.rb', line 3 def selector @selector end |
#stylesheet ⇒ Object
Returns the value of attribute stylesheet.
3 4 5 |
# File 'lib/motion-stylez/base.rb', line 3 def stylesheet @stylesheet end |
Class Method Details
.shared ⇒ Object
5 6 7 8 |
# File 'lib/motion-stylez/base.rb', line 5 def self.shared Dispatch.once { @shared ||= new } @shared end |
Instance Method Details
#style(style_names) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/motion-stylez/base.rb', line 10 def style(style_names) begin puts "\[STYLEZ ERROR] no stylesheet selected" unless self.stylesheet view = self.selector view = view.new if view.class == Class [style_names].flatten.each do |style| self.stylesheet.public_send(style, view) end yield view if block_given? view rescue NoMethodError => e if e. =~ /.*#{style_name.to_s}.*/ puts "\n[STYLEZ ERROR] style_name :#{style_name} doesn't exist for a #{view.class.name}. Add 'def #{style_name}(v)' to #{stylesheet.class.name} class\n\n" else raise e end end end |