Class: Waxy::Meta

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

Overview

Instances of Meta contain attributes that describe the visual appearance of a single hexagon.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#colorsArray

Returns 6 strings with SVG color= values.

Returns:

  • (Array)

    6 strings with SVG color= values



33
34
35
# File 'lib/waxy/meta.rb', line 33

def colors
  @colors
end

#fillObject

Hex fill not applicable to all templates



14
15
16
# File 'lib/waxy/meta.rb', line 14

def fill
  @fill
end

a URL for the whole hexagon not applicable to all templates



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

def link
  @link
end

title value for hex <a>



21
22
23
# File 'lib/waxy/meta.rb', line 21

def link_title
  @link_title
end

An Array (0..5) of links, one for each slice of ‘Pie’



30
31
32
# File 'lib/waxy/meta.rb', line 30

def pie_links
  @pie_links
end

#sizeObject

Array of 6 * (0.0..1.0)

scales "pie" slices


27
28
29
# File 'lib/waxy/meta.rb', line 27

def size
  @size
end

#strokeObject

Hex border SVG stroke



10
11
12
# File 'lib/waxy/meta.rb', line 10

def stroke
  @stroke
end

Instance Method Details



66
67
68
# File 'lib/waxy/meta.rb', line 66

def hex_link_end
  '</a>' if link
end

Helper methods



52
53
54
55
56
57
58
59
# File 'lib/waxy/meta.rb', line 52

def hex_link_start
  return nil unless link
  [
    '<a href="' + link + '"',
    'class="waxy__link"',
    '>'
  ].compact.join(' ')
end


61
62
63
64
# File 'lib/waxy/meta.rb', line 61

def hex_link_title
  return nil unless link_title 
  "<title>#{link_title}</title>"
end

#sum_sizeObject

Describes how “full” a pie hexagon is



46
47
48
# File 'lib/waxy/meta.rb', line 46

def sum_size
  size.sum
end