class Octo::TextGenerator
Constants
- TEMPLATES
Public Class Methods
generate(product, template=nil)
click to toggle source
Generate Notification
Template @param [Hash] product Details of the product @param [String] template Text Template
# File lib/octonotification/textgenerator.rb, line 13 def self.generate(product, template=nil) pHash = { name: product['name'], category: product[:categories].shuffle[0], price: product['price'].round(2) } if template.nil? TEMPLATES.sample % pHash else template % pHash end end