Class: Samantha::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/colors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hex) ⇒ Color

Returns a new instance of Color.



6
7
8
9
# File 'lib/colors.rb', line 6

def initialize(hex)
  @hex = hex
  @count = 1
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



4
5
6
# File 'lib/colors.rb', line 4

def count
  @count
end

#hexObject

Returns the value of attribute hex.



4
5
6
# File 'lib/colors.rb', line 4

def hex
  @hex
end

Instance Method Details

#tallyObject



11
12
13
# File 'lib/colors.rb', line 11

def tally
  @count += 1
end

#to_sObject



15
16
17
# File 'lib/colors.rb', line 15

def to_s
  "#{Paint['', @hex, nil]} ##{@hex.ljust(6)} #{@count.to_s}"
end