Class: MotionPixateLayout::Selector

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-pixate-layout/selector.rb

Constant Summary collapse

CLASS_PATTERN =
(/\.([^#\.\s]+)/)
ID_PATTERN =
(/#([^#\.\s]+)/)

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#stringObject (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_classesObject



11
12
13
# File 'lib/motion-pixate-layout/selector.rb', line 11

def style_classes
  @_classes ||= string.scan(CLASS_PATTERN).flatten
end

#style_idObject



15
16
17
# File 'lib/motion-pixate-layout/selector.rb', line 15

def style_id
  @_style_id ||= string.scan(ID_PATTERN).flatten.first
end