class Dsfu::Product
Attributes
category[RW]
company[RW]
description[R]
display_name[R]
file_name[R]
height[R]
image_path[RW]
price[R]
width[R]
Public Class Methods
new(opts)
click to toggle source
# File lib/dsfu/product.rb, line 8 def initialize(opts) @file_name = opts[:file_name] @display_name = opts[:display_name] @height = opts[:height] @width = opts[:width] @price = opts[:price] @company = opts[:company] || nil @category = opts[:category] @description = opts[:description] || nil @image_path = opts[:image_path] || nil end
Public Instance Methods
dimensions()
click to toggle source
# File lib/dsfu/product.rb, line 27 def dimensions "#{width}\" x #{height}\"" end
display_description()
click to toggle source
# File lib/dsfu/product.rb, line 20 def display_description string = [] string << dimensions string << description string.join("\n") end
find_image_path()
click to toggle source
# File lib/dsfu/product.rb, line 35 def find_image_path self.image_path = File.expand_path(Pathname.glob("#{file_name}")[0].to_path) end
name()
click to toggle source
# File lib/dsfu/product.rb, line 31 def name @company + " " + @category + " " + @display_name end
strip?()
click to toggle source
# File lib/dsfu/product.rb, line 39 def strip? DSFU::Size.new(width, height).strip? end