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
18 19 20 21 |
# File 'lib/usps_flags/config.rb', line 18 def initialize get_defaults yield self if block_given? end |
Instance Attribute Details
#clear ⇒ Object
11 12 13 |
# File 'lib/usps_flags/config.rb', line 11 def clear @clear end |
#flags_dir ⇒ Object
11 12 13 |
# File 'lib/usps_flags/config.rb', line 11 def flags_dir @flags_dir end |
#use_larger_tridents ⇒ Object
11 12 13 |
# File 'lib/usps_flags/config.rb', line 11 def use_larger_tridents @use_larger_tridents end |
Instance Method Details
#log_path ⇒ String
Alias for the directory to store generated log files.
79 80 81 82 83 84 85 |
# File 'lib/usps_flags/config.rb', line 79 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.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/usps_flags/config.rb', line 28 def trident point_height = USPSFlags::Config::BASE_FLY/48*17/8 = USPSFlags::Config::BASE_FLY/48 = *5/4 if USPSFlags.configuration.use_larger_tridents { height: trident_heights, center_point: BASE_FLY/2, width: USPSFlags::Config::BASE_FLY*5/32, bar_width: , point_height: point_height, main_point_barb: USPSFlags::Config::BASE_HOIST/240, crossbar_from_top: USPSFlags::Config::BASE_HOIST/4, side_spike_height: USPSFlags::Config::BASE_HOIST/4-point_height-, hash_width: USPSFlags::Config::BASE_FLY*3/32, delta_height: USPSFlags::Config::BASE_FLY*2/15, delta_gap_height: USPSFlags.configuration.use_larger_tridents ? USPSFlags::Config::BASE_FLY*14/256 : USPSFlags::Config::BASE_FLY*17/256, delta_gap_width: USPSFlags.configuration.use_larger_tridents ? *5/4 : *7/4, delta_width: USPSFlags::Config::BASE_FLY*43/768, delta_from_bottom: USPSFlags::Config::BASE_HOIST*11/64, delta_gap_scale: 0.40, delta_gap_x: USPSFlags::Config::BASE_HOIST*144/128, delta_gap_y: USPSFlags::Config::BASE_HOIST*221/256, circle_height_adj: USPSFlags::Config::BASE_FLY/800 } end |
#trident_heights ⇒ Hash
Height values for trident insignia.
67 68 69 70 71 72 73 74 |
# File 'lib/usps_flags/config.rb', line 67 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 |