lib/pdk/module/template_dir/base.rb
def object_template_for(object_type)
          object_path = File.join(@object_dir, "#{object_type}.erb")
          type_path = File.join(@object_dir, "#{object_type}_type.erb")
          device_path = File.join(@object_dir, "#{object_type}_device.erb")
          spec_path = File.join(@object_dir, "#{object_type}_spec.erb")
          type_spec_path = File.join(@object_dir, "#{object_type}_type_spec.erb")

          if PDK::Util::Filesystem.file?(object_path) && PDK::Util::Filesystem.readable?(object_path)
            result = { object: object_path }
            result[:type] = type_path if PDK::Util::Filesystem.file?(type_path) && PDK::Util::Filesystem.readable?(type_path)
            result[:spec] = spec_path if PDK::Util::Filesystem.file?(spec_path) && PDK::Util::Filesystem.readable?(spec_path)
            result[:device] = device_path if PDK::Util::Filesystem.file?(device_path) && PDK::Util::Filesystem.readable?(device_path)
            result[:type_spec] = type_spec_path if PDK::Util::Filesystem.file?(type_spec_path) && PDK::Util::Filesystem.readable?(type_spec_path)
            result
          else
            nil
          end
        end
# Searches the template directory for template files that can be used to
# render files for the specified object type.
#
# @param object_type [Symbol] The object type, e.g. (`:class`,
# `:defined_type`, `:fact`, etc).
#
# @return [Hash{Symbol => String}] if the templates are available in the
# template dir, otherwise `nil`. The returned hash can contain two keys,
# :object contains the path on disk to the template for the object, :spec
# contains the path on disk to the template for the object's spec file
# (if available).
#
# @api public
Searches the template directory for template files that can be used to
render files for the specified object type.
Searches the template directory for template files that can be used to render files for the specified object type .
def object_template_for(object_type)
          object_path = File.join(@object_dir, "#{object_type}.erb")
          type_path = File.join(@object_dir, "#{object_type}_type.erb")
          device_path = File.join(@object_dir, "#{object_type}_device.erb")
          spec_path = File.join(@object_dir, "#{object_type}_spec.erb")
          type_spec_path = File.join(@object_dir, "#{object_type}_type_spec.erb")
          if PDK::Util::Filesystem.file?(object_path) && PDK::Util::Filesystem.readable?(object_path)
            result = { object: object_path }
            result[:type] = type_path if PDK::Util::Filesystem.file?(type_path) && PDK::Util::Filesystem.readable?(type_path)
            result[:spec] = spec_path if PDK::Util::Filesystem.file?(spec_path) && PDK::Util::Filesystem.readable?(spec_path)
            result[:device] = device_path if PDK::Util::Filesystem.file?(device_path) && PDK::Util::Filesystem.readable?(device_path)
            result[:type_spec] = type_spec_path if PDK::Util::Filesystem.file?(type_spec_path) && PDK::Util::Filesystem.readable?(type_spec_path)
            result
          else
            nil
          end
        end
def object_template_for ( object_type ) object_path = File . join ( @object_dir , "#{object_type}.erb" ) type_path = File . join ( @object_dir , "#{object_type}_type.erb" ) device_path = File . join ( @object_dir , "#{object_type}_device.erb" ) spec_path = File . join ( @object_dir , "#{object_type}_spec.erb" ) type_spec_path = File . join ( @object_dir , "#{object_type}_type_spec.erb" ) if PDK :: Util :: Filesystem . file? ( object_path ) && PDK :: Util :: Filesystem . readable? ( object_path ) result = { object : object_path } result [ :type ] = type_path if PDK :: Util :: Filesystem . file? ( type_path ) && PDK :: Util :: Filesystem . readable? ( type_path ) result [ :spec ] = spec_path if PDK :: Util :: Filesystem . file? ( spec_path ) && PDK :: Util :: Filesystem . readable? ( spec_path ) result [ :device ] = device_path if PDK :: Util :: Filesystem . file? ( device_path ) && PDK :: Util :: Filesystem . readable? ( device_path ) result [ :type_spec ] = type_spec_path if PDK :: Util :: Filesystem . file? ( type_spec_path ) && PDK :: Util :: Filesystem . readable? ( type_spec_path ) result else nil end end
Searches the template directory for template files that can be used to
render files for the specified object type.
Searches the template directory for template files that can be used to render files for the specified object type .
if the templates are available in the template dir, otherwise `nil`. The returned hash can contain two keys, :object contains the path on disk to the template for the object, :spec contains the path on disk to the template for the object's spec file (if available).
if the templates are available in the template dir otherwise ` nil ` . The returned hash can contain two keys : object contains the path on disk to the template for the object : spec contains the path on disk to the template for the object ' s spec file ( if available ) .
Hash{Symbol => String}
object_type
The object type, e.g.
The object type e . g .
api
None