Class: Imagetools::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/imagetools/imagefilter.rb

Constant Summary collapse

FILENAME_SEARCH =
's (\d+)-(\d+)-(\d+) (\d+)\.(\d+)\.(\d+)'
FILENAME_REPLACE =
's_\1\2\3_\4\5\6'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(yaml) ⇒ Config

Returns a new instance of Config.



13
14
15
16
17
18
19
20
21
# 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

Instance Attribute Details

#filename_replace1Object (readonly)

Returns the value of attribute filename_replace1.



23
24
25
# File 'lib/imagetools/imagefilter.rb', line 23

def filename_replace1
  @filename_replace1
end

#filename_replace2Object (readonly)

Returns the value of attribute filename_replace2.



23
24
25
# File 'lib/imagetools/imagefilter.rb', line 23

def filename_replace2
  @filename_replace2
end

#filename_replace3Object (readonly)

Returns the value of attribute filename_replace3.



23
24
25
# File 'lib/imagetools/imagefilter.rb', line 23

def filename_replace3
  @filename_replace3
end

#filename_search1Object (readonly)

Returns the value of attribute filename_search1.



23
24
25
# File 'lib/imagetools/imagefilter.rb', line 23

def filename_search1
  @filename_search1
end

#filename_search2Object (readonly)

Returns the value of attribute filename_search2.



23
24
25
# File 'lib/imagetools/imagefilter.rb', line 23

def filename_search2
  @filename_search2
end

#filename_search3Object (readonly)

Returns the value of attribute filename_search3.



23
24
25
# File 'lib/imagetools/imagefilter.rb', line 23

def filename_search3
  @filename_search3
end

Instance Method Details

#filename_patternsObject



27
28
29
30
31
32
33
# File 'lib/imagetools/imagefilter.rb', line 27

def filename_patterns
  [
    [@filename_search1, @filename_replace1],
    [@filename_search2, @filename_replace2],
    [@filename_search3, @filename_replace3],  
  ]
end