class Alchemia::Plugins::Base

Public Class Methods

new(tree) click to toggle source
# File lib/alchemia/plugins/base.rb, line 5
def initialize(tree)
  @tree = tree
end

Public Instance Methods

all_properties(selector) click to toggle source
# File lib/alchemia/plugins/base.rb, line 33
def all_properties(selector)
  properties = []
  @tree.each do |t|
    if is_rule(t)
      t[:children].each do |child|
        if is_property(child)
          properties.push child[:name]
        end
      end
    end
  end
  ptoperties
end
all_selectors() click to toggle source
# File lib/alchemia/plugins/base.rb, line 13
def all_selectors
  selectors = []
  @tree.each do |t|
    if is_rule(t)
      selectors.push t[:selector][:value]
    end
  end
  selectors
end
process() click to toggle source
# File lib/alchemia/plugins/base.rb, line 9
def process
  nil
end
selector(selector) click to toggle source
# File lib/alchemia/plugins/base.rb, line 23
def selector(selector)
  @tree.each do |t|
    if is_rule(t)
      if selector == t[:selector][:value]
        return t[:selector][:tokens][1][:raw]
      end
    end
  end
end

Private Instance Methods

is_child(child) click to toggle source
# File lib/alchemia/plugins/base.rb, line 58
def is_child(child)
  true if child[:node] == :property
end
is_property(node) click to toggle source
# File lib/alchemia/plugins/base.rb, line 54
def is_property(node)
  true if node[:property] == :property
end
is_rule(node) click to toggle source
# File lib/alchemia/plugins/base.rb, line 50
def is_rule(node)
  true if node[:node] == :style_rule
end