Sha256: 1c90e75f1ad7e1c28fb838cebab78d0b0bd6c3598c9c83245560d5e95d6cc99d
Contents?: true
Size: 672 Bytes
Versions: 94
Compression:
Stored size: 672 Bytes
Contents
class ProductDropdownPresenter class Option def initialize(product) @product = product end def path @path ||= @product['path'] end def icon @icon ||= @product['icon'] end def name @name ||= @product['name'] end end def initialize(scope) @scope = scope end def options @options ||= begin products.select { |p| scoped_products.include?(p['path']) }.map do |p| Option.new(p) end end end def scoped_products @scoped_products ||= @scope.map(&:products).flatten.uniq end def products @products ||= Product.all.select { |p| p['dropdown'] == true } end end
Version data entries
94 entries across 94 versions & 1 rubygems