Module: Boxspring::Pictureable
- Included in:
- Attribution, Property
- Defined in:
- lib/boxspring/pictureable.rb
Instance Method Summary collapse
Instance Method Details
#picture_by_code_name(code_name) {|picture| ... } ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/boxspring/pictureable.rb', line 15 def picture_by_code_name( code_name ) picture = self.pictures.detect do | picture | picture.code_name == code_name end yield picture if picture.present? && block_given? pictures 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 |