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

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 =
"1.0.1"

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.



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

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



32
33
34
35
36
37
38
# File 'lib/ase.rb', line 32

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.



15
16
17
# File 'lib/ase.rb', line 15

def palettes
  @palettes
end

Instance Method Details

#[](name) ⇒ Object



28
29
30
# File 'lib/ase.rb', line 28

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

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



22
23
24
25
# File 'lib/ase.rb', line 22

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