class Imagetools::Config
Constants
- FILENAME_REPLACE
- FILENAME_SEARCH
Attributes
filename_replace1[R]
filename_replace2[R]
filename_replace3[R]
filename_search1[R]
filename_search2[R]
filename_search3[R]
Public Class Methods
new(yaml)
click to toggle source
# File lib/imagetools/imagefilter.rb, line 13 def initialize(yaml) @yaml = yaml @filename_search1 = config_value("filename", "search1", false) || FILENAME_SEARCH @filename_replace1 = config_value("filename", "replace1", false) || FILENAME_REPLACE @filename_search2 = config_value("filename", "search2", false) @filename_replace2 = config_value("filename", "replace2", false) @filename_search3 = config_value("filename", "search3", false) @filename_replace3 = config_value("filename", "replace3", false) end
Public Instance Methods
filename_patterns()
click to toggle source
# File lib/imagetools/imagefilter.rb, line 27 def filename_patterns [ [@filename_search1, @filename_replace1], [@filename_search2, @filename_replace2], [@filename_search3, @filename_replace3], ] end
Private Instance Methods
config_value(section, key, require)
click to toggle source
# File lib/imagetools/imagefilter.rb, line 36 def config_value(section, key, require) return nil unless @yaml value = @yaml[section][key] if require && (value.nil? || value.empty?) raise RuntimeError, "#{section}:#{key}: is empty" end value end