Class: Rpictogrify::Themes::Base

Inherits:
Object
  • Object
show all
Extended by:
SingleForwardable
Includes:
Singleton
Defined in:
lib/rpictogrify/themes/base.rb

Direct Known Subclasses

AvataarsFemale, AvataarsMale, MaleFlat, Monsters

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



17
18
19
20
21
# File 'lib/rpictogrify/themes/base.rb', line 17

def initialize
  @ident    = get_ident
  @mapping  = parse_mapping
  @resource = parse_resource
end

Instance Attribute Details

#identObject (readonly)

Returns the value of attribute ident.



13
14
15
# File 'lib/rpictogrify/themes/base.rb', line 13

def ident
  @ident
end

#mappingObject (readonly)

Returns the value of attribute mapping.



13
14
15
# File 'lib/rpictogrify/themes/base.rb', line 13

def mapping
  @mapping
end

#resourceObject (readonly)

Returns the value of attribute resource.



13
14
15
# File 'lib/rpictogrify/themes/base.rb', line 13

def resource
  @resource
end

Instance Method Details

#colorsObject



35
36
37
# File 'lib/rpictogrify/themes/base.rb', line 35

def colors
  mapping['colors']
end

#heightObject



27
28
29
# File 'lib/rpictogrify/themes/base.rb', line 27

def height
  view_box[3]
end

#shapesObject



31
32
33
# File 'lib/rpictogrify/themes/base.rb', line 31

def shapes
  mapping['shapes']
end

#symbol(id) ⇒ Object



39
40
41
# File 'lib/rpictogrify/themes/base.rb', line 39

def symbol(id)
  resource.at_xpath("//*[@id='#{id}']")
end

#widthObject



23
24
25
# File 'lib/rpictogrify/themes/base.rb', line 23

def width
  view_box[2]
end