Class: Glimmer::DSL::CSS::RuleExpression

Inherits:
Expression
  • Object
show all
Includes:
ParentExpression
Defined in:
lib/glimmer/dsl/css/rule_expression.rb

Instance Method Summary collapse

Methods included from ParentExpression

#add_content

Methods inherited from Expression

#add_content, dsl, #textual?, #widget?

Instance Method Details

#can_interpret?(parent, keyword, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/glimmer/dsl/css/rule_expression.rb', line 11

def can_interpret?(parent, keyword, *args, &block)
  parent.is_a?(Glimmer::CSS::StyleSheet) and
    block_given? and
    args.empty?
end

#interpret(parent, keyword, *args, &block) ⇒ Object



17
18
19
20
21
# File 'lib/glimmer/dsl/css/rule_expression.rb', line 17

def interpret(parent, keyword, *args, &block)
  Glimmer::CSS::Rule.new(keyword.to_s.downcase).tap do |rule|
    parent.rules << rule
  end
end