Class: Terret::Composition::Resolved

Inherits:
Data
  • Object
show all
Defined in:
lib/terret/composition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#homeObject (readonly)

Returns the value of attribute home

Returns:

  • (Object)

    the current value of home



95
96
97
# File 'lib/terret/composition.rb', line 95

def home
  @home
end

#pluginsObject (readonly)

Returns the value of attribute plugins

Returns:

  • (Object)

    the current value of plugins



95
96
97
# File 'lib/terret/composition.rb', line 95

def plugins
  @plugins
end

#profileObject (readonly)

Returns the value of attribute profile

Returns:

  • (Object)

    the current value of profile



95
96
97
# File 'lib/terret/composition.rb', line 95

def profile
  @profile
end

#requiresObject (readonly)

Returns the value of attribute requires

Returns:

  • (Object)

    the current value of requires



95
96
97
# File 'lib/terret/composition.rb', line 95

def requires
  @requires
end

#rowsObject (readonly)

Returns the value of attribute rows

Returns:

  • (Object)

    the current value of rows



95
96
97
# File 'lib/terret/composition.rb', line 95

def rows
  @rows
end

#settingsObject (readonly)

Returns the value of attribute settings

Returns:

  • (Object)

    the current value of settings



95
96
97
# File 'lib/terret/composition.rb', line 95

def settings
  @settings
end

Instance Method Details

#materialize(allow_config_ruby: false) ⇒ Object

Rows in the shape Hames::Loader#layer wants, tags evaluated. plugin is still the class NAME: resolving the constant is boot's job, because a row whose constant does not resolve is something doctor reports rather than something a dump-config discovers halfway through.



100
101
102
103
104
105
106
107
108
# File 'lib/terret/composition.rb', line 100

def materialize(allow_config_ruby: false)
  values = Composition.materialize_settings(settings, allow_config_ruby: allow_config_ruby)
  rows.map do |r|
    { id: r.id, plugin: r.plugin, disabled: r.disabled,
      config: Composition.materialize(r.config, settings: values,
                                                allow_config_ruby: allow_config_ruby,
                                                where: "row #{r.id.inspect} (config from #{r.config_layer})") }
  end
end

#row(id) ⇒ Object



110
# File 'lib/terret/composition.rb', line 110

def row(id) = rows.find { |r| r.id == id.to_s }