Class: MiniMagick::Tool::OptionMethods
- Inherits:
-
Module
- Object
- Module
- MiniMagick::Tool::OptionMethods
- Defined in:
- lib/mini_magick/tool.rb
Overview
Dynamically generates modules with dynamically generated option methods for each command-line tool. It uses the ‘-help` page of a command-line tool and generates methods from it. It then includes the generated module into the tool class.
Class Method Summary collapse
-
.instances ⇒ Object
think about it for a minute.
Instance Method Summary collapse
-
#initialize(tool_name) ⇒ OptionMethods
constructor
A new instance of OptionMethods.
-
#reload_methods ⇒ Object
Dynamically generates operator methods from the “-help” page.
- #to_s ⇒ Object
Constructor Details
#initialize(tool_name) ⇒ OptionMethods
Returns a new instance of OptionMethods.
181 182 183 184 185 |
# File 'lib/mini_magick/tool.rb', line 181 def initialize(tool_name) @tool_name = tool_name reload_methods self.class.instances << self end |
Class Method Details
.instances ⇒ Object
think about it for a minute
177 178 179 |
# File 'lib/mini_magick/tool.rb', line 177 def self.instances @instances ||= [] end |
Instance Method Details
#reload_methods ⇒ Object
Dynamically generates operator methods from the “-help” page.
194 195 196 197 198 |
# File 'lib/mini_magick/tool.rb', line 194 def reload_methods instance_methods(false).each { |method| undef_method(method) } creation_operator *creation_operators option * end |
#to_s ⇒ Object
187 188 189 |
# File 'lib/mini_magick/tool.rb', line 187 def to_s "OptionMethods(#{@tool_name})" end |