Class: ASE

Inherits:
Object
  • Object
show all
Includes:
Reader, Writer
Defined in:
lib/ase/color.rb,
lib/ase.rb,
lib/ase/file.rb,
lib/ase/reader.rb,
lib/ase/writer.rb,
lib/ase/palette.rb,
lib/ase/version.rb,
lib/ase/color_modes/rgb.rb,
lib/ase/color_modes/cmyk.rb,
lib/ase/color_modes/gray.rb

Overview

Nice little wrapper that lets us easily perform some functions on a given color.

Defined Under Namespace

Modules: Reader, Writer Classes: Color, File, Palette

Constant Summary collapse

VERSION =
"2.0.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Writer

#to_file, #write!

Methods included from Reader

included

Constructor Details

#initialize(file = nil) ⇒ ASE

Returns a new instance of ASE.



20
21
22
23
# File 'lib/ase.rb', line 20

def initialize(file=nil)
  @file = file
  @palettes = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/ase.rb', line 35

def method_missing(method, *args, &block)
  if @palettes.has_key?(method.to_s)
    return @palettes[method.to_s]
  end

  super
end

Instance Attribute Details

#palettesObject

Returns the value of attribute palettes.



18
19
20
# File 'lib/ase.rb', line 18

def palettes
  @palettes
end

Instance Method Details

#[](name) ⇒ Object



31
32
33
# File 'lib/ase.rb', line 31

def [](name)
  @palettes[name]
end

#add_palette(palette) ⇒ Object Also known as: <<



25
26
27
28
# File 'lib/ase.rb', line 25

def add_palette(palette)
  raise "Can only pass an ASE::Palette" unless palette.is_a?(ASE::Palette)
  @palettes[palette.name] = palette
end