Class: MotionPixateLayout::Selector
- Inherits:
-
Object
- Object
- MotionPixateLayout::Selector
- Defined in:
- lib/motion-pixate-layout/selector.rb
Constant Summary collapse
- CLASS_PATTERN =
(/\.([^#\.\s]+)/)
- ID_PATTERN =
(/#([^#\.\s]+)/)
Instance Attribute Summary collapse
-
#string ⇒ Object
readonly
Returns the value of attribute string.
Instance Method Summary collapse
-
#initialize(string) ⇒ Selector
constructor
A new instance of Selector.
- #style_classes ⇒ Object
- #style_id ⇒ Object
Constructor Details
#initialize(string) ⇒ Selector
Returns a new instance of Selector.
7 8 9 |
# File 'lib/motion-pixate-layout/selector.rb', line 7 def initialize(string) @string = string end |
Instance Attribute Details
#string ⇒ Object (readonly)
Returns the value of attribute string.
3 4 5 |
# File 'lib/motion-pixate-layout/selector.rb', line 3 def string @string end |
Instance Method Details
#style_classes ⇒ Object
11 12 13 |
# File 'lib/motion-pixate-layout/selector.rb', line 11 def style_classes @_classes ||= string.scan(CLASS_PATTERN).flatten end |
#style_id ⇒ Object
15 16 17 |
# File 'lib/motion-pixate-layout/selector.rb', line 15 def style_id @_style_id ||= string.scan(ID_PATTERN).flatten.first end |