lib/roadie/stylesheet.rb in roadie-4.0.0 vs lib/roadie/stylesheet.rb in roadie-5.0.0

- old
+ new

@@ -6,11 +6,11 @@ # It has a name and a list of {StyleBlock}s. # # @attr_reader [String] name the name of the stylesheet ("stylesheets/main.css", "Admin user styles", etc.). The name of the stylesheet will be visible if any errors occur. # @attr_reader [Array<StyleBlock>] blocks class Stylesheet - BOM = (+"\xEF\xBB\xBF").force_encoding('UTF-8').freeze + BOM = (+"\xEF\xBB\xBF").force_encoding("UTF-8").freeze attr_reader :name, :blocks # Parses the CSS string into a {StyleBlock}s and stores it. # @@ -19,26 +19,15 @@ def initialize(name, css) @name = name @blocks = parse_blocks(css.sub(BOM, "")) end - # @yield [selector, properties] - # @yieldparam [Selector] selector - # @yieldparam [Array<StyleProperty>] properties - # @deprecated Iterate over the #{blocks} instead. Will be removed on version 4.0. - def each_inlinable_block(&block) - # #map and then #each in order to support chained enumerations, etc. if - # no block is provided - inlinable_blocks.map { |style_block| - [style_block.selector, style_block.properties] - }.each(&block) - end - def to_s blocks.join("\n") end private + def inlinable_blocks blocks.select(&:inlinable?) end def parse_blocks(css)