Class: CanTango::Configuration::Categories::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/cantango/configuration/categories.rb

Instance Method Summary collapse

Constructor Details

#initialize(*subjects) ⇒ Category

Returns a new instance of Category.



40
41
42
# File 'lib/cantango/configuration/categories.rb', line 40

def initialize *subjects
  @subjects = subjects.flatten
end

Instance Method Details

#has_any?(subject, &block) ⇒ Boolean

test if a particular category has a certain subject

Returns:

  • (Boolean)


49
50
51
52
53
# File 'lib/cantango/configuration/categories.rb', line 49

def has_any? subject, &block
  found = subjects.include? subject
  yield if found && block
  found
end

#subjectsObject



44
45
46
# File 'lib/cantango/configuration/categories.rb', line 44

def subjects
  @subjects ||= []
end