Module: MdRecord::Categorizable

Extended by:
ActiveSupport::Concern
Defined in:
lib/md_record/categorizable.rb

Instance Method Summary collapse

Instance Method Details

#category?(other) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
49
# File 'lib/md_record/categorizable.rb', line 46

def category?(other)
  key = other.is_a?(Category) ? other.key : other
  category == key
end

#category_nameObject



51
52
53
# File 'lib/md_record/categorizable.rb', line 51

def category_name
  self.class.instance_variable_get(:@md_record_categories).dig(category, :name) || category.to_s.tr("-_", " ").capitalize
end