class Carraway::Category
Attributes
key[R]
title[R]
Public Class Methods
all()
click to toggle source
# File lib/carraway/category.rb, line 15 def all @categories.values end
find(key)
click to toggle source
# File lib/carraway/category.rb, line 11 def find(key) @categories.fetch(key) end
load(categories)
click to toggle source
# File lib/carraway/category.rb, line 4 def load(categories) @categories = categories.inject({}) do |hash, (key, attributes)| hash[key] = new(key: key, title: attributes['title'], dir: attributes['dir']) hash end end
new(key:, title:, dir:)
click to toggle source
# File lib/carraway/category.rb, line 22 def initialize(key:, title:, dir:) @key = key @title = title @dir = dir end
Public Instance Methods
fullpath(uid)
click to toggle source
# File lib/carraway/category.rb, line 28 def fullpath(uid) [@dir, uid].join end