Class: PaletteTown::Rule

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

Instance Method Summary collapse

Constructor Details

#initialize(rule) ⇒ Rule



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/palettetown/rule.rb', line 9

def initialize rule
  # TODO: Need to find nearest console color
  # TODO: Create PaletteTown::TermColor class
  @keys = {}
  @keys[:guifg] = PaletteTown::Color.new(rule[:fg])
  @keys[:ctermfg] = rule[:fg_term]
  @keys[:guibg] = PaletteTown::Color.new(rule[:bg])
  @keys[:ctermbg] = rule[:bg_term]
  @keys[:gui] = rule[:style]
  @keys[:cterm] = rule[:style_term]
end

Instance Method Details

#[](key) ⇒ Object



3
4
5
# File 'lib/palettetown/rule.rb', line 3

def [] key
  @keys[key]
end

#each(&block) ⇒ Object



6
7
8
# File 'lib/palettetown/rule.rb', line 6

def each &block
  @keys.each(&block)
end