Module: Boxspring::Pictureable

Included in:
Attribution
Defined in:
lib/boxspring/pictureable.rb

Instance Method Summary collapse

Instance Method Details

#picture_by_code_name(code_name) ⇒ Object



15
16
17
# File 'lib/boxspring/pictureable.rb', line 15

def picture_by_code_name(code_name)
  self.pictures.detect{ |picture| picture.code_name == code_name }
end

#pictures ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/boxspring/pictureable.rb', line 5

def pictures
  @_pictures ||= begin
    self.attributes.include?( :pictures ) ?
      self.attributes[ :pictures ].map do | picture |
        Picture.new( picture )
      end :
      nil
  end
end