Sha256: 2af4464eace761c91c95812487d054c87705379e669aa69ac0089474cd91e80d

Contents?: true

Size: 760 Bytes

Versions: 17

Compression:

Stored size: 760 Bytes

Contents

module Bulldog
  class Style
    def initialize(name, attributes={})
      @name = name
      @attributes = attributes
    end

    attr_reader :name, :attributes

    #
    # Return the value of the given style attribute.
    #
    delegate :[], :to => :attributes

    #
    # Set the value of the given style attribute.
    #
    delegate :[]=, :to => :attributes

    #
    # Return true if the argument is a Style with the same name and
    # attributes.
    #
    def ==(other)
      other.is_a?(self.class) &&
        name == other.name &&
        attributes == other.attributes
    end

    def inspect
      "#<Style #{name.inspect} #{attributes.inspect}>"
    end

    delegate :hash, :eql?, :to => :name

    ORIGINAL = new(:original, {})
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bulldog-0.1.1 lib/bulldog/style.rb
bulldog-0.1.0 lib/bulldog/style.rb
bulldog-0.0.15 lib/bulldog/style.rb
bulldog-0.0.14 lib/bulldog/style.rb
bulldog-0.0.13 lib/bulldog/style.rb
bulldog-0.0.12 lib/bulldog/style.rb
bulldog-0.0.11 lib/bulldog/style.rb
bulldog-0.0.10 lib/bulldog/style.rb
bulldog-0.0.9 lib/bulldog/style.rb
bulldog-0.0.8 lib/bulldog/style.rb
bulldog-0.0.7 lib/bulldog/style.rb
bulldog-0.0.6 lib/bulldog/style.rb
bulldog-0.0.5 lib/bulldog/style.rb
bulldog-0.0.3 lib/bulldog/style.rb
bulldog-0.0.4 lib/bulldog/style.rb
bulldog-0.0.2 lib/bulldog/style.rb
bulldog-0.0.1 lib/bulldog/style.rb