Class: Badge

Inherits:
Object
  • Object
show all
Defined in:
lib/codeschool/badge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dom) ⇒ Badge

Returns a new instance of Badge.



4
5
6
7
# File 'lib/codeschool/badge.rb', line 4

def initialize(dom)
  @name = dom.text.strip
  @image = dom.css('img').first.attributes['src'].value
end

Instance Attribute Details

#imageObject (readonly)

Returns the value of attribute image.



2
3
4
# File 'lib/codeschool/badge.rb', line 2

def image
  @image
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/codeschool/badge.rb', line 2

def name
  @name
end