Class: PuppetGenerator::PuppetObjects::File

Inherits:
Object
  • Object
show all
Includes:
PuppetGenerator::PuppetHelper
Defined in:
lib/puppet_generator/puppet_objects/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PuppetGenerator::PuppetHelper

#puppet_class_name, #puppet_manifest_path, #puppet_module_name, #puppet_module_path

Constructor Details

#initialize(entry, module_name, class_name) ⇒ File

Returns a new instance of File.



9
10
11
12
13
14
15
16
17
18
# File 'lib/puppet_generator/puppet_objects/file.rb', line 9

def initialize(entry, module_name, class_name)
  @path = entry[:name]
  @module_name = module_name
  @class_name = class_name

  @owner = entry[:owner]
  @mode = entry[:mode]
  @type = entry.fetch( :type, 'file' )
  @source = entry[:source]
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



7
8
9
# File 'lib/puppet_generator/puppet_objects/file.rb', line 7

def class_name
  @class_name
end

#modeObject (readonly)

Returns the value of attribute mode.



7
8
9
# File 'lib/puppet_generator/puppet_objects/file.rb', line 7

def mode
  @mode
end

#module_nameObject (readonly)

Returns the value of attribute module_name.



7
8
9
# File 'lib/puppet_generator/puppet_objects/file.rb', line 7

def module_name
  @module_name
end

#ownerObject (readonly)

Returns the value of attribute owner.



7
8
9
# File 'lib/puppet_generator/puppet_objects/file.rb', line 7

def owner
  @owner
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/puppet_generator/puppet_objects/file.rb', line 7

def path
  @path
end

#sourceObject (readonly)

Returns the value of attribute source.



7
8
9
# File 'lib/puppet_generator/puppet_objects/file.rb', line 7

def source
  @source
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/puppet_generator/puppet_objects/file.rb', line 7

def type
  @type
end

Instance Method Details

#nameObject



20
21
22
# File 'lib/puppet_generator/puppet_objects/file.rb', line 20

def name
  ::File.basename(path)
end

#suggested_file_nameObject



24
25
26
# File 'lib/puppet_generator/puppet_objects/file.rb', line 24

def suggested_file_name
  puppet_manifest_path( name )
end