Class: Lookbook::StylesExtractor
- Defined in:
- lib/lookbook/services/templates/styles_extractor.rb
Constant Summary collapse
- STYLE_TAGS_REGEX =
/<style(?:\s[^>]*)?>((?:(?!<\/style>).)*)<\/style>/m
Instance Attribute Summary collapse
- #content ⇒ Object readonly
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(content) ⇒ StylesExtractor
constructor
A new instance of StylesExtractor.
Methods inherited from Service
Constructor Details
#initialize(content) ⇒ StylesExtractor
Returns a new instance of StylesExtractor.
9 10 11 |
# File 'lib/lookbook/services/templates/styles_extractor.rb', line 9 def initialize(content) @content = content.to_s end |
Instance Attribute Details
#content ⇒ Object (readonly)
7 8 9 |
# File 'lib/lookbook/services/templates/styles_extractor.rb', line 7 def content @content end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 |
# File 'lib/lookbook/services/templates/styles_extractor.rb', line 13 def call styles = extract_styles(content) rest = strip_styles(content) [styles, rest] end |