Class: Magick::OptionalMethodArguments

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

Overview

Collects non-specific optional method arguments

Instance Method Summary collapse

Constructor Details

#initialize(img) ⇒ OptionalMethodArguments

Returns a new instance of OptionalMethodArguments.



1803
1804
1805
# File 'lib/rmagick_internal.rb', line 1803

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



1808
1809
1810
# File 'lib/rmagick_internal.rb', line 1808

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



1813
1814
1815
# File 'lib/rmagick_internal.rb', line 1813

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

#highlight_color=(color) ⇒ Object

accepts Pixel object or color name



1818
1819
1820
1821
# File 'lib/rmagick_internal.rb', line 1818

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



1824
1825
1826
1827
# File 'lib/rmagick_internal.rb', line 1824

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