Class: CanTango::Category
- Inherits:
-
Object
- Object
- CanTango::Category
- Defined in:
- lib/cantango/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.
3 4 5 |
# File 'lib/cantango/category.rb', line 3 def initialize *subjects @subjects = subjects.flatten end |
Instance Method Details
#has_any?(subject, &block) ⇒ Boolean
test if a particular category has a certain subject
12 13 14 15 16 |
# File 'lib/cantango/category.rb', line 12 def has_any? subject, &block found = subjects.include? subject yield if found && block found end |
#subjects ⇒ Object
7 8 9 |
# File 'lib/cantango/category.rb', line 7 def subjects @subjects ||= [] end |