Sha256: 3512839d49eaf4b5b86913a0a9b217063584c28ca44d38966d4cabf8ab3ded38

Contents?: true

Size: 601 Bytes

Versions: 12

Compression:

Stored size: 601 Bytes

Contents

require 'glimmer/dsl/expression'
require 'glimmer/css/style_sheet'
require 'glimmer/css/rule'

module Glimmer
  module DSL
    module CSS
      class RuleExpression < Expression
        include ParentExpression

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
glimmer-0.8.2 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.8.1 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.8.0 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.8 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.7 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.6 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.5 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.4 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.3 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.2 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.1 lib/glimmer/dsl/css/rule_expression.rb
glimmer-0.7.0 lib/glimmer/dsl/css/rule_expression.rb