Class: InitialAvatar::Configuration

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

Constant Summary collapse

OPTIONS =
%i[text_color size font_weight font_family seed].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/initial_avatar/configuration.rb', line 12

def initialize
  @colors = %w[
    #1abc9c #16a085 #f1c40f #f39c12 #2ecc71 #27ae60 #e67e22 #d35400 #3498db
    #2980b9 #e74c3c #c0392b #9b59b6 #8e44ad #bdc3c7 #34495e #2c3e50 #95a5a6
    #7f8c8d #ec87bf #d870ad #f69785 #9ba37e #b49255 #b49255 #a94136
  ]
  @text_color = '#ffffff'
  @size = 100
  @font_weight = 400
  @font_family = 'HelveticaNeue-Light,Helvetica Neue Light,Helvetica Neue,Helvetica, Arial,Lucida Grande, sans-serif'
  @seed = 0
end

Instance Attribute Details

#colorsObject

Returns the value of attribute colors.



5
6
7
# File 'lib/initial_avatar/configuration.rb', line 5

def colors
  @colors
end

#font_familyObject

Returns the value of attribute font_family.



9
10
11
# File 'lib/initial_avatar/configuration.rb', line 9

def font_family
  @font_family
end

#font_weightObject

Returns the value of attribute font_weight.



8
9
10
# File 'lib/initial_avatar/configuration.rb', line 8

def font_weight
  @font_weight
end

#seedObject

Returns the value of attribute seed.



10
11
12
# File 'lib/initial_avatar/configuration.rb', line 10

def seed
  @seed
end

#sizeObject

Returns the value of attribute size.



7
8
9
# File 'lib/initial_avatar/configuration.rb', line 7

def size
  @size
end

#text_colorObject

Returns the value of attribute text_color.



6
7
8
# File 'lib/initial_avatar/configuration.rb', line 6

def text_color
  @text_color
end

Instance Method Details

#default_optionsObject



25
26
27
# File 'lib/initial_avatar/configuration.rb', line 25

def default_options
  OPTIONS.map { |key| [key, public_send(key)] }.to_h
end