Class: UtilityPalettes::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/utility_palettes/configuration.rb', line 11

def initialize
  # Enabled Environments
  @enable_environments = [:development]

  # Defaults
  @use_default_absolutes = true
  @use_default_relatives = true
  @use_default_singles = true

  # Output
  @output_filename = 'utility_palettes'
  @output_dated = false
  @output_files = ['scss']
  @output_format = 'hex'
  @output_prefix = ''
  @output_suffix = ''

  # Method
  @method = 'hsl'

  # Steps
  @steps_h = 0
  @steps_s = 3
  @steps_l = 8
  @steps_r = 9
  @steps_g = 9
  @steps_b = 9

  # Colors - Absolutes
  @absolutes = {}

  # Colors - Relatives
  @relatives = {}

  # Colors - Singles
  @singles = {}
end

Instance Attribute Details

#absolutesObject

Returns the value of attribute absolutes.



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

def absolutes
  @absolutes
end

#enable_environmentsObject

Returns the value of attribute enable_environments.



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

def enable_environments
  @enable_environments
end

#methodObject

Returns the value of attribute method.



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

def method
  @method
end

#output_datedObject

Returns the value of attribute output_dated.



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

def output_dated
  @output_dated
end

#output_filenameObject

Returns the value of attribute output_filename.



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

def output_filename
  @output_filename
end

#output_filesObject

Returns the value of attribute output_files.



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

def output_files
  @output_files
end

#output_formatObject

Returns the value of attribute output_format.



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

def output_format
  @output_format
end

#output_prefixObject

Returns the value of attribute output_prefix.



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

def output_prefix
  @output_prefix
end

#output_suffixObject

Returns the value of attribute output_suffix.



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

def output_suffix
  @output_suffix
end

#relativesObject

Returns the value of attribute relatives.



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

def relatives
  @relatives
end

#singlesObject

Returns the value of attribute singles.



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

def singles
  @singles
end

#steps_bObject

Returns the value of attribute steps_b.



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

def steps_b
  @steps_b
end

#steps_gObject

Returns the value of attribute steps_g.



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

def steps_g
  @steps_g
end

#steps_hObject

Returns the value of attribute steps_h.



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

def steps_h
  @steps_h
end

#steps_lObject

Returns the value of attribute steps_l.



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

def steps_l
  @steps_l
end

#steps_rObject

Returns the value of attribute steps_r.



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

def steps_r
  @steps_r
end

#steps_sObject

Returns the value of attribute steps_s.



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

def steps_s
  @steps_s
end

#use_default_absolutesObject

Returns the value of attribute use_default_absolutes.



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

def use_default_absolutes
  @use_default_absolutes
end

#use_default_relativesObject

Returns the value of attribute use_default_relatives.



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

def use_default_relatives
  @use_default_relatives
end

#use_default_singlesObject

Returns the value of attribute use_default_singles.



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

def use_default_singles
  @use_default_singles
end

Instance Method Details

#reset!Object



49
50
51
# File 'lib/utility_palettes/configuration.rb', line 49

def reset!
  self.initialize
end

#validate_settingsObject



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/utility_palettes/configuration.rb', line 53

def validate_settings
  warn "ERROR: The colour sequence method you have submitted to Utility Palettes < #{@method} > is not available" unless @method.to_s.in?(['hsl'])

  # warn "ERROR: The colour sequence steps you have submitted to Utility Palettes < #{@steps} > have not been formatted as a hash" unless @steps.is_a?(Hash)

  warn "ERROR: The output files you have submitted to Utility Palettes < #{@output_files} > have not been formatted as an array" unless @absolutes.is_a?(Array)

  warn "ERROR: The absolute swatches you have submitted to Utility Palettes < #{@absolutes} > have not been formatted as a hash" unless @absolutes.is_a?(Hash)
  warn "ERROR: The relative swatches you have submitted to Utility Palettes < #{@relatives} > have not been formatted as a hash" unless @relatives.is_a?(Hash)
  warn "ERROR: The single swatches you have submitted to Utility Palettes < #{@singles} > have not been formatted as a hash" unless @singles.is_a?(Hash)

  [@method.to_s.in?(['hsl']), @absolutes.is_a?(Hash), @relatives.is_a?(Hash), @singles.is_a?(Hash)].all?
end