Class: USPSFlags::Config
- Inherits:
-
Object
- Object
- USPSFlags::Config
- Defined in:
- lib/usps_flags/config.rb
Overview
Container class for configuration values.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Config
constructor
Configuration constructor.
-
#log_path ⇒ String
Alias for the directory to store generated log files.
-
#trident ⇒ Hash
Base configuration values for trident insignia.
-
#trident_heights ⇒ Hash
Height values for trident insignia.
Constructor Details
#initialize {|_self| ... } ⇒ Config
Configuration constructor
22 23 24 25 |
# File 'lib/usps_flags/config.rb', line 22 def initialize get_defaults yield self if block_given? end |
Instance Attribute Details
#clear ⇒ Object
16 17 18 |
# File 'lib/usps_flags/config.rb', line 16 def clear @clear end |
#flags_dir ⇒ Object
16 17 18 |
# File 'lib/usps_flags/config.rb', line 16 def flags_dir @flags_dir end |
Instance Method Details
#log_path ⇒ String
Alias for the directory to store generated log files.
55 56 57 58 59 60 61 |
# File 'lib/usps_flags/config.rb', line 55 def log_path if defined?(::Rails) "#{::Rails.root}/log" else "#{USPSFlags.configuration.flags_dir}/log" end end |
#trident ⇒ Hash
Base configuration values for trident insignia.
All other values are derived from these, or directly from the constant sizes.
32 33 34 35 36 37 38 |
# File 'lib/usps_flags/config.rb', line 32 def trident { height: trident_heights, center_point: BASE_FLY / 2, width: USPSFlags::Config::BASE_FLY * 5 / 32, bar_width: , hash_width: USPSFlags::Config::BASE_FLY * 47 / 528 }.merge(spikes_config).merge(delta_config).merge(circle_config) end |
#trident_heights ⇒ Hash
Height values for trident insignia.
43 44 45 46 47 48 49 50 |
# File 'lib/usps_flags/config.rb', line 43 def trident_heights { s: USPSFlags::Config::BASE_HOIST / 2, d: USPSFlags::Config::BASE_HOIST * 5 / 8, stf: USPSFlags::Config::BASE_HOIST * 3 / 4, n: USPSFlags::Config::BASE_HOIST * 3 / 4 } end |