Class: CanTango::Configuration::Category
- Inherits:
-
Object
- Object
- CanTango::Configuration::Category
- Defined in:
- lib/cantango/configuration/category.rb
Instance Method Summary collapse
-
#has_any?(subject, &block) ⇒ Boolean
test if a particular category has a certain subject.
-
#initialize(*subjects) ⇒ Category
constructor
A new instance of Category.
- #subjects ⇒ Object
Constructor Details
#initialize(*subjects) ⇒ Category
Returns a new instance of Category.
4 5 6 |
# File 'lib/cantango/configuration/category.rb', line 4 def initialize *subjects @subjects = subjects.flatten end |
Instance Method Details
#has_any?(subject, &block) ⇒ Boolean
test if a particular category has a certain subject
13 14 15 16 17 |
# File 'lib/cantango/configuration/category.rb', line 13 def has_any? subject, &block found = subjects.include? subject yield if found && block found end |
#subjects ⇒ Object
8 9 10 |
# File 'lib/cantango/configuration/category.rb', line 8 def subjects @subjects ||= [] end |