Class: AttachmentMagick::CustomStyle

Inherits:
Object
  • Object
show all
Defined in:
lib/attachment_magick/configuration/custom_style.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object



4
5
6
7
# File 'lib/attachment_magick/configuration/custom_style.rb', line 4

def method_missing(meth, *args, &blk)
  instance_variable_set "@#{meth}", args.first
  self.class.class_eval { attr_reader meth.to_sym }
end

Instance Method Details

#stylesObject



9
10
11
12
13
14
15
16
17
# File 'lib/attachment_magick/configuration/custom_style.rb', line 9

def styles
  hash = {}
  instance_variables.each do |method|
    method = method.to_s.gsub("@", "")
    hash.merge!({ method.to_sym => send(method) })
  end
  
  return hash
end