Class: Magick::OptionalMethodArguments

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

Overview

Collects non-specific optional method arguments

Instance Method Summary collapse

Constructor Details

#initialize(img) ⇒ OptionalMethodArguments

Returns a new instance of OptionalMethodArguments.


1839
1840
1841
# File 'lib/RMagick.rb', line 1839

def initialize(img)
   @img = img
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(mth, val) ⇒ Object

miscellaneous options like -verbose


1844
1845
1846
# File 'lib/RMagick.rb', line 1844

def method_missing(mth, val)
   @img.define(mth.to_s.tr('_', '-'), val)
end

Instance Method Details

#define(key, val = nil) ⇒ Object

set(key, val) corresponds to -set option:key val


1849
1850
1851
# File 'lib/RMagick.rb', line 1849

def define(key, val = nil)
   @img.define(key, val)
end

#highlight_color=(color) ⇒ Object

accepts Pixel object or color name


1854
1855
1856
1857
# File 'lib/RMagick.rb', line 1854

def highlight_color=(color)
   color = @img.to_color(color) if color.respond_to?(:to_color)
   @img.define("highlight-color", color)
end

#lowlight_color=(color) ⇒ Object

accepts Pixel object or color name


1860
1861
1862
1863
# File 'lib/RMagick.rb', line 1860

def lowlight_color=(color)
   color = @img.to_color(color) if color.respond_to?(:to_color)
   @img.define("lowlight-color", color)
end