Class: Ottogen::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/ottogen/collection.rb

Constant Summary collapse

DIR_PREFIX =
'_'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, output:) ⇒ Collection

Returns a new instance of Collection.



16
17
18
19
20
# File 'lib/ottogen/collection.rb', line 16

def initialize(name:, output:)
  @name = name
  @output = output
  @items = discover_items
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



14
15
16
# File 'lib/ottogen/collection.rb', line 14

def items
  @items
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/ottogen/collection.rb', line 14

def name
  @name
end

Class Method Details

.from_config(name, settings) ⇒ Object



9
10
11
12
# File 'lib/ottogen/collection.rb', line 9

def self.from_config(name, settings)
  output = settings.is_a?(Hash) && settings['output'] == true
  new(name: name, output: output)
end

Instance Method Details

#output?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/ottogen/collection.rb', line 22

def output?
  @output
end