Class: Nucleo::Models::Tags

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/nucleo/models/tags.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


17
18
19
# File 'lib/nucleo/models/tags.rb', line 17

def has_snippet?
  self.any?
end

#snippetString

Returns the code snippet

Returns:

  • (String)


25
26
27
# File 'lib/nucleo/models/tags.rb', line 25

def snippet
  self.map(&:snippet).join("\n")
end