Sha256: eccfc566e734fa3a7c6b0481c5d6710c1b2e617e4b66f6e1a80cd33bcf5d3a9c
Contents?: true
Size: 1.2 KB
Versions: 5
Compression:
Stored size: 1.2 KB
Contents
module Ore module Template # # The templates registered with the generator. # # @return [Hash{Symbol => String}] # The template names and paths. # # @api semipublic # # @since 0.9.0 # def self.templates @@templates ||= {} end # # Determines whether a template was registered. # # @param [Symbol, String] name # The name of the template. # # @return [Boolean] # Specifies whether the template was registered. # # @api semipublic # # @since 0.9.0 # def self.template?(name) self.templates.has_key?(name.to_sym) end # # Registers a template with the generator. # # @param [String] path # The path to the template. # # @return [Symbol] # The name of the registered template. # # @raise [StandardError] # The given path was not a directory. # # @api semipublic # # @since 0.9.0 # def self.register(path) unless File.directory?(path) raise(StandardError,"#{path.dump} is must be a directory") end name = File.basename(path).to_sym self.templates[name] = path return name end end end
Version data entries
5 entries across 5 versions & 1 rubygems