Class: Ea::Theme::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/theme/loader.rb

Overview

Loads theme Definition objects from YAML files.

YAML format (see config/themes/119.yml):

id: "119"
name: EA White Theme
font: { family: Carlito, size: 7, unit: pt, weight_normal: 400, ... }
element_font: { size: 9, unit: pt }
colors: { text: "#000000", attribute_text: "#66413F", ... }
strokes: { element_border: 2, connector_line: 2, ... }
text_metrics: { width_factor: 0.65 }
canvas: { inset_left: 35, inset_right: 50, ... }
frame: { inset: 6, tab_height: 20, ... }
compartments: { header_line_offset: 4, ... }
attribute: { visibility_x_offset: 5, content_x_offset: 20 }
markers: { diamond_half_width: 5, ... }
package: { tab_height: 20, ... }
note: { fold_size: 12, ... }
fills: {}

Class Method Summary collapse

Class Method Details

.load_dir(dir) ⇒ Object



32
33
34
# File 'lib/ea/theme/loader.rb', line 32

def load_dir(dir)
  Dir.glob(File.join(dir, "*.yml")).map { |f| load_file(f) }
end

.load_file(path) ⇒ Object



27
28
29
30
# File 'lib/ea/theme/loader.rb', line 27

def load_file(path)
  data = YAML.load_file(path)
  from_hash(data)
end