Class: Tsumetogi::Config
- Inherits:
-
Object
- Object
- Tsumetogi::Config
- Defined in:
- lib/tsumetogi/config.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ resolution: 150, crop_x: 0, crop_y: 0, crop_w: 0, crop_h: 0, diff_strategy: "Digest", verbose: false, progress: true, text: true, }
Instance Attribute Summary collapse
-
#crop_h ⇒ Object
Returns the value of attribute crop_h.
-
#crop_w ⇒ Object
Returns the value of attribute crop_w.
-
#crop_x ⇒ Object
Returns the value of attribute crop_x.
-
#crop_y ⇒ Object
Returns the value of attribute crop_y.
-
#diff_strategy ⇒ Object
Returns the value of attribute diff_strategy.
-
#images_dir ⇒ Object
Returns the value of attribute images_dir.
-
#progress ⇒ Object
Returns the value of attribute progress.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
-
#text ⇒ Object
Returns the value of attribute text.
-
#text_path ⇒ Object
Returns the value of attribute text_path.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tsumetogi/config.rb', line 27 def initialize( = {}) config_path = [:config] if config_path config = YAML.load(File.read(config_path)) config && config.each do |k, v| writer_method = "#{k}=" if self.respond_to?(writer_method) self.send(writer_method, v) else warn "Unknown config item found: #{k}" end end end # set option-specified or default values DEFAULT_OPTIONS.each do |k, v| self.send("#{k}=", [k] || v) if instance_variable_get("@#{k}").nil? end end |
Instance Attribute Details
#crop_h ⇒ Object
Returns the value of attribute crop_h.
7 8 9 |
# File 'lib/tsumetogi/config.rb', line 7 def crop_h @crop_h end |
#crop_w ⇒ Object
Returns the value of attribute crop_w.
7 8 9 |
# File 'lib/tsumetogi/config.rb', line 7 def crop_w @crop_w end |
#crop_x ⇒ Object
Returns the value of attribute crop_x.
7 8 9 |
# File 'lib/tsumetogi/config.rb', line 7 def crop_x @crop_x end |
#crop_y ⇒ Object
Returns the value of attribute crop_y.
7 8 9 |
# File 'lib/tsumetogi/config.rb', line 7 def crop_y @crop_y end |
#diff_strategy ⇒ Object
Returns the value of attribute diff_strategy.
9 10 11 |
# File 'lib/tsumetogi/config.rb', line 9 def diff_strategy @diff_strategy end |
#images_dir ⇒ Object
Returns the value of attribute images_dir.
8 9 10 |
# File 'lib/tsumetogi/config.rb', line 8 def images_dir @images_dir end |
#progress ⇒ Object
Returns the value of attribute progress.
11 12 13 |
# File 'lib/tsumetogi/config.rb', line 11 def progress @progress end |
#resolution ⇒ Object
Returns the value of attribute resolution.
6 7 8 |
# File 'lib/tsumetogi/config.rb', line 6 def resolution @resolution end |
#text ⇒ Object
Returns the value of attribute text.
12 13 14 |
# File 'lib/tsumetogi/config.rb', line 12 def text @text end |
#text_path ⇒ Object
Returns the value of attribute text_path.
13 14 15 |
# File 'lib/tsumetogi/config.rb', line 13 def text_path @text_path end |
#verbose ⇒ Object
Returns the value of attribute verbose.
10 11 12 |
# File 'lib/tsumetogi/config.rb', line 10 def verbose @verbose end |