class DTK::Puppet::ParseStructure::ComponentPS
Public Class Methods
new(ast_item, opts = {})
click to toggle source
Calls superclass method
# File lib/dtk_puppet/parse_structure.rb, line 120 def initialize(ast_item, opts = {}) ast_item_type = ast_item.type type = case ast_item_type when :hostclass 'class' when :definition 'definition' else fail DTK::Client::Error.new('unexpected type for ast_item') end self['type'] = type self['name'] = ast_item.name attributes = [] attributes << AttributePS.create_name_attribute if ast_item_type == :definition (ast_item.arguments || []).each { |arg| attributes << AttributePS.create(arg, opts) } self['attributes'] = attributes unless attributes.empty? super end