Class: AvatarOMatic::Config
- Inherits:
-
Object
- Object
- AvatarOMatic::Config
- Defined in:
- lib/avatar_o_matic/config.rb
Class Attribute Summary collapse
-
.image_lib ⇒ Object
Returns the value of attribute image_lib.
Class Method Summary collapse
Class Attribute Details
.image_lib ⇒ Object
Returns the value of attribute image_lib.
7 8 9 |
# File 'lib/avatar_o_matic/config.rb', line 7 def image_lib @image_lib end |
Class Method Details
.image_data ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/avatar_o_matic/config.rb', line 25 def image_data return @_data if @_data @_data = {} re_file = / \/ (#{self.types.join('|')}) \/ (#{self.properties.join('|')}) \d+ \.png \Z/xo Find.find(image_lib) do |path| m = re_file.match(path) or next type = m[1].to_sym prop = m[2].to_sym @_data[type] ||= {} @_data[type][prop] ||= [] @_data[type][prop] << path end @_data end |
.options_for(type, prop) ⇒ Object
21 22 23 |
# File 'lib/avatar_o_matic/config.rb', line 21 def (type, prop) image_data[type.to_sym][prop.to_sym] end |
.properties ⇒ Object
13 14 15 |
# File 'lib/avatar_o_matic/config.rb', line 13 def properties [:background, :face, :clothes, :head, :eye, :mouth] end |
.types ⇒ Object
17 18 19 |
# File 'lib/avatar_o_matic/config.rb', line 17 def types [:male, :female] end |