Sha256: f774f5b8653f284973827d4c6b8f962db759d0beb2943086a5d31f0d7652c4b7

Contents?: true

Size: 447 Bytes

Versions: 1

Compression:

Stored size: 447 Bytes

Contents

module Keydown
  class Classnames

    def initialize(names = '')
      @names = []
      add(names)
    end

    def add(names)
      @names += names.split(" ")
      @names.uniq!
    end

    def remove(names)
      @names -= names.split(' ')
    end

    def include?(name)
      @names.include? name
    end

    def to_hash
      @names.empty? ? {} : { :class => self.to_s }
    end

    def to_s
      @names.sort.join(' ')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
keydown-0.9.2 lib/keydown/classnames.rb