class Stylesheet::CssRule

Constants

CHARSET_RULE
FONT_FACE_RULE
IMPORT_RULE
MEDIA_RULE
NULL_RULE
STYLE_RULE

Attributes

rule_classes[R]
css_text[R]
parent_rule[R]
parent_style_sheet[R]
type[W]

Public Class Methods

factory(args) click to toggle source
# File lib/stylesheet/css_rule.rb, line 25
def self.factory(args)
  rule = CssRule.rule_classes.find do |klass| 
    klass.matches_rule?(args[:css_text])
  end
  rule.new(args) if rule
end
inherited(subclass) click to toggle source
# File lib/stylesheet/css_rule.rb, line 21
def self.inherited(subclass)
  CssRule.rule_classes << subclass
end
new(args) click to toggle source
# File lib/stylesheet/css_rule.rb, line 33
def initialize(args)
  @parent_style_sheet = args[:parent_style_sheet]
  @parent_rule        = args[:parent_rule]
  @css_text           = args[:css_text]
  parse_css_text
end

Public Instance Methods

matches_rule?() click to toggle source
# File lib/stylesheet/css_rule.rb, line 44
def matches_rule?
  false
end
to_s() click to toggle source
# File lib/stylesheet/css_rule.rb, line 48
def to_s
  "#<#{self.class.name} css_text:#{css_text}>"
end
type() click to toggle source
# File lib/stylesheet/css_rule.rb, line 40
def type
  raise NotImplementedError
end

Private Instance Methods

parse_css_text() click to toggle source
# File lib/stylesheet/css_rule.rb, line 54
def parse_css_text
  raise NotImplementedError
end