Sha256: 3937dcc06e869847ceae01dc45b55fd43df90b708f2d790f653997be698fa627

Contents?: true

Size: 427 Bytes

Versions: 1

Compression:

Stored size: 427 Bytes

Contents

module BeautifulCss

  class Rule
    def initialize(str)
      @body = str
    end

    def selectors
      @body.match(/[^{]*/).to_s.split(/,/).map{|s| s.strip}.select{|s| !s.empty? }
    end

    def props
      begin
      p = @body.match(/\{([^}]*)/)[1].split(';').select{|s| !s.strip.empty? }
      p.map{|s| "{ " + s.strip + " }"}
      rescue
        []
      end
    end

    def body
      @body
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beautiful-css-0.0.1 lib/beautiful-css/rule.rb