Class: Nucleo::Models::Tags
- Inherits:
-
Object
- Object
- Nucleo::Models::Tags
- Includes:
- Enumerable
- Defined in:
- lib/nucleo/models/tags.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#has_snippet? ⇒ Boolean
(also: #snippet?)
Returns true if there is a snipped.
-
#initialize(collection) ⇒ Tags
constructor
A new instance of Tags.
-
#snippet ⇒ String
Returns the code snippet.
Constructor Details
#initialize(collection) ⇒ Tags
Returns a new instance of Tags.
6 7 8 |
# File 'lib/nucleo/models/tags.rb', line 6 def initialize(collection) @collection = Array(collection) end |
Instance Method Details
#each(&block) ⇒ Object
10 11 12 |
# File 'lib/nucleo/models/tags.rb', line 10 def each(&block) internal_collection.each(&block) end |
#has_snippet? ⇒ Boolean Also known as: snippet?
Returns true if there is a snipped
17 18 19 |
# File 'lib/nucleo/models/tags.rb', line 17 def has_snippet? self.any? end |
#snippet ⇒ String
Returns the code snippet
25 26 27 |
# File 'lib/nucleo/models/tags.rb', line 25 def snippet self.map(&:snippet).join("\n") end |