Class: Sirens::Icons

Inherits:
Object
  • Object
show all
Defined in:
lib/sirens/models/icons.rb

Class Method Summary collapse

Class Method Details

.icon_for(object) ⇒ Object

Initializing



22
23
24
25
26
# File 'lib/sirens/models/icons.rb', line 22

def self.icon_for(object)
    filename = icons.fetch(object.class, 'object.png')

    Pathname.new(__FILE__).dirname + '../../../resources/icons/' + filename 
end

.iconsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sirens/models/icons.rb', line 6

def self.icons()
    @icons ||= Hash[
        ::Module => 'module.png',
        ::Class => 'class.png',
        ::Array => 'array.png',
        ::Hash => 'hash.png',
        ::TrueClass => 'true.png',
        ::FalseClass => 'false.png',
        ::String => 'string.png',
        ::Integer => 'number.png',
        ::Float => 'number.png',
    ]
end