Class: GeoWorks::Derivatives::Config::RenderingConfiguration
- Inherits:
-
Object
- Object
- GeoWorks::Derivatives::Config::RenderingConfiguration
- Defined in:
- lib/geo_works/derivatives/config.rb
Instance Attribute Summary collapse
- #bg_color ⇒ Object
- #fill ⇒ Object
- #line_cap ⇒ Object
- #line_join ⇒ Object
- #radius ⇒ Object
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
- #stroke ⇒ Object
- #weight ⇒ Object
Instance Method Summary collapse
- #config_file ⇒ Object
- #config_root_path ⇒ Object
-
#initialize ⇒ RenderingConfiguration
constructor
A new instance of RenderingConfiguration.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ RenderingConfiguration
Returns a new instance of RenderingConfiguration.
21 22 23 |
# File 'lib/geo_works/derivatives/config.rb', line 21 def initialize @settings ||= File.exist?(config_file) ? YAML.load_file(config_file) : {} end |
Instance Attribute Details
#bg_color ⇒ Object
48 49 50 |
# File 'lib/geo_works/derivatives/config.rb', line 48 def bg_color @bg_color ||= settings.fetch('bg_color', '#ffffff00') end |
#fill ⇒ Object
52 53 54 |
# File 'lib/geo_works/derivatives/config.rb', line 52 def fill @fill ||= settings.fetch('fill', '#e4e3ea') end |
#line_cap ⇒ Object
64 65 66 |
# File 'lib/geo_works/derivatives/config.rb', line 64 def line_cap @line_cap ||= settings.fetch('line_cap', 'square') end |
#line_join ⇒ Object
68 69 70 |
# File 'lib/geo_works/derivatives/config.rb', line 68 def line_join @line_join ||= settings.fetch('line_join', 'miter') end |
#radius ⇒ Object
72 73 74 |
# File 'lib/geo_works/derivatives/config.rb', line 72 def radius @radius ||= settings.fetch('radius', '2') end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
12 13 14 |
# File 'lib/geo_works/derivatives/config.rb', line 12 def settings @settings end |
#stroke ⇒ Object
56 57 58 |
# File 'lib/geo_works/derivatives/config.rb', line 56 def stroke @stroke ||= settings.fetch('stroke', '#483d8b') end |
#weight ⇒ Object
60 61 62 |
# File 'lib/geo_works/derivatives/config.rb', line 60 def weight @weight ||= settings.fetch('weight', '0.3') end |
Instance Method Details
#config_file ⇒ Object
25 26 27 |
# File 'lib/geo_works/derivatives/config.rb', line 25 def config_file File.join(config_root_path, 'config/simpler_tiles.yml') end |
#config_root_path ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/geo_works/derivatives/config.rb', line 29 def config_root_path if defined?(Rails) && Rails.root Rails.root else Pathname.new(Dir.pwd) end end |
#to_h ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/geo_works/derivatives/config.rb', line 37 def to_h { 'stroke' => stroke, 'line-cap' => line_cap, 'line-join' => line_join, 'weight' => weight, 'fill' => fill, 'radius' => radius } end |