Class: Stylish::Selectors

Inherits:
Array
  • Object
show all
Includes:
Formattable
Defined in:
lib/stylish/core.rb

Overview

Selectors objects are simply used to group Selector objects for more convenient storage and serialisation.

Instance Method Summary collapse

Methods included from Formattable

included

Instance Method Details

#join(symbols = {}, scope = "") ⇒ Object

The join method overrides the superclass’ method in order to always use a specific separator, and so that the scope that the selectors are being used in can be passed through when Rules etc. are serialised.



226
227
228
229
230
# File 'lib/stylish/core.rb', line 226

def join(symbols = {}, scope = "")
  self.inject("") do |ss, s|
    (ss.empty? ? "" : ss + self.class.format) + s.to_s(symbols, scope)
  end
end

#to_s(symbols = {}, scope = "") ⇒ Object

The to_s method alternative way of calling the join method.



233
234
235
# File 'lib/stylish/core.rb', line 233

def to_s(symbols = {}, scope = "")
  self.join(symbols, scope)
end