source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/property/list.rb
Ruby
apache-2.0
7,843
main
1,794
# frozen_string_literal: true require_relative '../../puppet/property' module Puppet class Property # This subclass of {Puppet::Property} manages an unordered list of values. # For an ordered list see {Puppet::Property::OrderedList}. # class List < Property def is_to_s(currentvalue) # rubocop:...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/property/ensure.rb
Ruby
apache-2.0
7,843
main
3,260
# frozen_string_literal: true require_relative '../../puppet/property' # This property is automatically added to any {Puppet::Type} that responds # to the methods 'exists?', 'create', and 'destroy'. # # Ensure defaults to having the wanted _(should)_ value `:present`. # # @api public # class Puppet::Property::Ensure ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/ffi/windows.rb
Ruby
apache-2.0
7,843
main
280
# frozen_string_literal: true require 'ffi' module Puppet module FFI module Windows require_relative 'windows/api_types' require_relative 'windows/constants' require_relative 'windows/structs' require_relative 'windows/functions' end end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/ffi/posix/functions.rb
Ruby
apache-2.0
7,843
main
555
# frozen_string_literal: true require_relative '../../../puppet/ffi/posix' module Puppet::FFI::POSIX module Functions extend FFI::Library ffi_convention :stdcall # https://man7.org/linux/man-pages/man3/getgrouplist.3.html # int getgrouplist ( # const char *user, # gid_t group, # ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/ffi/posix/constants.rb
Ruby
apache-2.0
7,843
main
417
# frozen_string_literal: true require_relative '../../../puppet/ffi/posix' module Puppet::FFI::POSIX module Constants extend FFI::Library # Maximum number of supplementary groups (groups # that a user can be in plus its primary group) # (64 + 1 primary group) # Chosen a reasonable middle number...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/ffi/windows/structs.rb
Ruby
apache-2.0
7,843
main
11,266
# coding: utf-8 # frozen_string_literal: true require_relative '../../../puppet/ffi/windows' module Puppet::FFI::Windows module Structs extend FFI::Library extend Puppet::FFI::Windows::APITypes # https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa379560(v=vs.85) # typedef s...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/ffi/windows/functions.rb
Ruby
apache-2.0
7,843
main
24,126
# frozen_string_literal: true require_relative '../../../puppet/ffi/windows' module Puppet::FFI::Windows module Functions extend FFI::Library include Puppet::FFI::Windows::Constants ffi_convention :stdcall # https://docs.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-sethandleinforma...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/ffi/windows/constants.rb
Ruby
apache-2.0
7,843
main
16,812
# frozen_string_literal: true require_relative '../../../puppet/ffi/windows' module Puppet::FFI::Windows module Constants extend FFI::Library FILE_ATTRIBUTE_READONLY = 0x00000001 FILE_ATTRIBUTE_DIRECTORY = 0x00000010 # https://msdn.microsoft.com/en-us/library/windows/desktop/aa379607(v=vs...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/ffi/windows/api_types.rb
Ruby
apache-2.0
7,843
main
10,986
# frozen_string_literal: true require_relative '../../../puppet/ffi/windows' require_relative '../../../puppet/util/windows/string' module Puppet::FFI::Windows module APITypes module ::FFI WIN32_FALSE = 0 # standard Win32 error codes ERROR_SUCCESS = 0 end module ::FFI::Library ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/response.rb
Ruby
apache-2.0
7,843
main
2,489
# frozen_string_literal: true # Represents the response returned from the server from an HTTP request. # # @api abstract # @api public class Puppet::HTTP::Response # @return [URI] the response url attr_reader :url # Create a response associated with the URL. # # @param [URI] url # @param [Integer] HTTP st...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/errors.rb
Ruby
apache-2.0
7,843
main
1,388
# frozen_string_literal: true module Puppet::HTTP # A base class for puppet http errors # @api public class HTTPError < Puppet::Error; end # A connection error such as if the server refuses the connection. # @api public class ConnectionError < HTTPError; end # A failure to route to the server such as i...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/site.rb
Ruby
apache-2.0
7,843
main
874
# frozen_string_literal: true # Represents a site to which HTTP connections are made. It is a value # object, and is suitable for use in a hash. If two sites are equal, # then a persistent connection made to the first site, can be re-used # for the second. # # @api private class Puppet::HTTP::Site attr_reader :schem...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/proxy.rb
Ruby
apache-2.0
7,843
main
3,186
# frozen_string_literal: true require 'uri' require_relative '../../puppet/ssl/openssl_loader' module Puppet::HTTP::Proxy def self.proxy(uri) if http_proxy_host && !no_proxy?(uri) Net::HTTP.new(uri.host, uri.port, http_proxy_host, http_proxy_port, http_proxy_user, http_proxy_password) else http ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/response_net_http.rb
Ruby
apache-2.0
7,843
main
937
# frozen_string_literal: true # Adapts Net::HTTPResponse to Puppet::HTTP::Response # # @api public class Puppet::HTTP::ResponseNetHTTP < Puppet::HTTP::Response # Create a response associated with the URL. # # @param [URI] url # @param [Net::HTTPResponse] nethttp The response def initialize(url, nethttp) ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/dns.rb
Ruby
apache-2.0
7,843
main
5,529
# frozen_string_literal: true require 'resolv' module Puppet::HTTP class DNS class CacheEntry attr_reader :records, :ttl, :resolution_time def initialize(records) @records = records @resolution_time = Time.now @ttl = choose_lowest_ttl(records) end def choose_low...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/response_converter.rb
Ruby
apache-2.0
7,843
main
917
# frozen_string_literal: true module Puppet::HTTP::ResponseConverter module_function # Borrowed from puppetserver, see https://github.com/puppetlabs/puppetserver/commit/a1ebeaaa5af590003ccd23c89f808ba4f0c89609 def to_ruby_response(response) str_code = response.code.to_s # Copied from Net::HTTPResponse ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/external_client.rb
Ruby
apache-2.0
7,843
main
2,483
# frozen_string_literal: true # Adapts an external http_client_class to the HTTP client API. The former # is typically registered by puppetserver and only implements a subset of # the Puppet::Network::HTTP::Connection methods. As a result, only the # `get` and `post` methods are supported. Calling `delete`, etc will #...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/pool.rb
Ruby
apache-2.0
7,843
main
4,366
# frozen_string_literal: true # A pool for persistent `Net::HTTP` connections. Connections are # stored in the pool indexed by their {Site}. # Connections are borrowed from the pool, yielded to the caller, and # released back into the pool. If a connection is expired, it will be # closed either when a connection to th...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/client.rb
Ruby
apache-2.0
7,843
main
18,888
# frozen_string_literal: true # The HTTP client provides methods for making `GET`, `POST`, etc requests to # HTTP(S) servers. It also provides methods for resolving Puppetserver REST # service endpoints using SRV records and settings (such as `server_list`, # `server`, `ca_server`, etc). Once a service endpoint has be...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/resolver.rb
Ruby
apache-2.0
7,843
main
1,663
# frozen_string_literal: true # Resolver base class. Each resolver represents a different strategy for # resolving a service name into a list of candidate servers and ports. # # @abstract Subclass and override {#resolve} to create a new resolver. # @api public class Puppet::HTTP::Resolver # # Create a new resolver...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/pool_entry.rb
Ruby
apache-2.0
7,843
main
444
# frozen_string_literal: true # An entry in the peristent HTTP pool that references the connection and # an expiration time for the connection. # # @api private class Puppet::HTTP::PoolEntry attr_reader :connection, :verifier def initialize(connection, verifier, expiration_time) @connection = connection @...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/redirector.rb
Ruby
apache-2.0
7,843
main
2,831
# frozen_string_literal: true # Handle HTTP redirects # # @api private class Puppet::HTTP::Redirector # Create a new redirect handler # # @param [Integer] redirect_limit maximum number of redirects allowed # # @api private def initialize(redirect_limit) @redirect_limit = redirect_limit end # Deter...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/retry_after_handler.rb
Ruby
apache-2.0
7,843
main
2,285
# frozen_string_literal: true require 'date' require 'time' # Parse information relating to responses containing a Retry-After headers # # @api private class Puppet::HTTP::RetryAfterHandler # Create a handler to allow the system to sleep between HTTP requests # # @param [Integer] retry_limit number of retries a...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/factory.rb
Ruby
apache-2.0
7,843
main
1,452
# frozen_string_literal: true require_relative '../../puppet/ssl/openssl_loader' require 'net/http' require_relative '../../puppet/http' # Factory for `Net::HTTP` objects. # # Encapsulates the logic for creating a `Net::HTTP` object based on the # specified {Site} and puppet settings. # # @api private class Puppet::H...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/session.rb
Ruby
apache-2.0
7,843
main
4,347
# frozen_string_literal: true # The session is the mechanism by which services may be connected to and accessed. # # @api public class Puppet::HTTP::Session # capabilities for a site CAP_LOCALES = 'locales' CAP_JSON = 'json' # puppet version where locales mount was added SUPPORTED_LOCALES_MOUNT_AGENT_VERSIO...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/service.rb
Ruby
apache-2.0
7,843
main
5,883
# frozen_string_literal: true # Represents an abstract Puppet web service. # # @abstract Subclass and implement methods for the service's REST APIs. # @api public class Puppet::HTTP::Service # @return [URI] the url associated with this service attr_reader :url # @return [Array<Symbol>] available services SERV...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/resolver/settings.rb
Ruby
apache-2.0
7,843
main
958
# frozen_string_literal: true # Resolve a service using settings. This is the default resolver if none of the # other resolvers find a functional connection. # # @api public class Puppet::HTTP::Resolver::Settings < Puppet::HTTP::Resolver # Resolve a service using the default server and port settings for this service...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/resolver/server_list.rb
Ruby
apache-2.0
7,843
main
3,943
# frozen_string_literal: true # Use the server_list setting to resolve a service. This resolver is only used # if server_list is set either on the command line or in the configuration file. # # @api public class Puppet::HTTP::Resolver::ServerList < Puppet::HTTP::Resolver # Create a server list resolver. # # @par...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/resolver/srv.rb
Ruby
apache-2.0
7,843
main
1,434
# frozen_string_literal: true # Resolve a service using DNS SRV records. # # @api public class Puppet::HTTP::Resolver::SRV < Puppet::HTTP::Resolver # Create an DNS SRV resolver. # # @param [Puppet::HTTP::Client] client # @param [String] domain srv domain # @param [Resolv::DNS] dns # def initialize(client...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/service/puppetserver.rb
Ruby
apache-2.0
7,843
main
1,687
# frozen_string_literal: true # The puppetserver service. # # @api public # class Puppet::HTTP::Service::Puppetserver < Puppet::HTTP::Service # Use `Puppet::HTTP::Session.route_to(:puppetserver)` to create or get an instance of this class. # # @param [Puppet::HTTP::Client] client # @param [Puppet::HTTP::Sessio...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/service/report.rb
Ruby
apache-2.0
7,843
main
2,052
# frozen_string_literal: true # The Report service is used to submit run reports to the report server. # # @api public # class Puppet::HTTP::Service::Report < Puppet::HTTP::Service # @return [String] Default API for the report service API = '/puppet/v3' # Use `Puppet::HTTP::Session.route_to(:report)` to create ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/service/ca.rb
Ruby
apache-2.0
7,843
main
4,400
# frozen_string_literal: true # The CA service is used to handle certificate related REST requests. # # @api public class Puppet::HTTP::Service::Ca < Puppet::HTTP::Service # @return [Hash] default headers for the ca service HEADERS = { 'Accept' => 'text/plain' }.freeze # @return [String] default API for the ca ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/service/compiler.rb
Ruby
apache-2.0
7,843
main
13,869
# frozen_string_literal: true # The Compiler service is used to submit and retrieve data from the # puppetserver. # # @api public class Puppet::HTTP::Service::Compiler < Puppet::HTTP::Service # @return [String] Default API for the Compiler service API = '/puppet/v3' # Use `Puppet::HTTP::Session.route_to(:puppet...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/http/service/file_server.rb
Ruby
apache-2.0
7,843
main
7,496
# frozen_string_literal: true require_relative '../../../puppet/file_serving/metadata' # The FileServer service is used to retrieve file metadata and content. # # @api public # class Puppet::HTTP::Service::FileServer < Puppet::HTTP::Service # @return [String] Default API for the FileServer service API = '/puppet/...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/inline_epp.rb
Ruby
apache-2.0
7,843
main
2,516
# frozen_string_literal: true # Evaluates an Embedded Puppet (EPP) template string and returns the rendered # text result as a String. # # `inline_epp('<EPP TEMPLATE STRING>', <PARAMETER HASH>)` # # The first argument to this function should be a string containing an EPP # template. In most cases, the last argument is...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/split.rb
Ruby
apache-2.0
7,843
main
2,161
# frozen_string_literal: true # Splits a string into an array using a given pattern. # The pattern can be a string, regexp or regexp type. # # @example Splitting a String value # # ```puppet # $string = 'v1.v2:v3.v4' # $array_var1 = split($string, /:/) # $array_var2 = split($string, '[.]') # $array_var3 = split($s...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/getvar.rb
Ruby
apache-2.0
7,843
main
3,462
# frozen_string_literal: true # Digs into a variable with dot notation to get a value from a structure. # # **To get the value from a variable** (that may or may not exist), call the function with # one or two arguments: # # * The **first** argument must be a string, and must start with a variable name without leading...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/floor.rb
Ruby
apache-2.0
7,843
main
1,200
# frozen_string_literal: true # Returns the largest `Integer` less or equal to the argument. # Takes a single numeric value as an argument. # # This function is backwards compatible with the same function in stdlib # and accepts a `Numeric` value. A `String` that can be converted # to a floating point number can also ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/module_directory.rb
Ruby
apache-2.0
7,843
main
1,284
# frozen_string_literal: true # Finds an existing module and returns the path to its root directory. # # The argument to this function should be a module name String # For example, the reference `mysql` will search for the # directory `<MODULES DIRECTORY>/mysql` and return the first # found on the modulepath. # # This...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/lstrip.rb
Ruby
apache-2.0
7,843
main
1,704
# frozen_string_literal: true # Strips leading spaces from a String # # This function is compatible with the stdlib function with the same name. # # The function does the following: # * For a `String` the conversion removes all leading ASCII white space characters such as space, tab, newline, and return. # It does n...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/epp.rb
Ruby
apache-2.0
7,843
main
2,106
# frozen_string_literal: true # Evaluates an Embedded Puppet (EPP) template file and returns the rendered text # result as a String. # # `epp('<MODULE NAME>/<TEMPLATE FILE>', <PARAMETER HASH>)` # # The first argument to this function should be a `<MODULE NAME>/<TEMPLATE FILE>` # reference, which loads `<TEMPLATE FILE>...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/lookup.rb
Ruby
apache-2.0
7,843
main
10,036
# frozen_string_literal: true # Uses the Puppet lookup system to retrieve a value for a given key. By default, # this returns the first value found (and fails compilation if no values are # available), but you can configure it to merge multiple values into one, fail # gracefully, and more. # # When looking up a key, P...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/keys.rb
Ruby
apache-2.0
7,843
main
715
# frozen_string_literal: true # Returns the keys of a hash as an Array # # @example Using `keys` # # ```puppet # $hsh = {"apples" => 3, "oranges" => 4 } # $hsh.keys() # keys($hsh) # # both results in the array ["apples", "oranges"] # ``` # # * Note that a hash in the puppet language accepts any data value (including `...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/binary_file.rb
Ruby
apache-2.0
7,843
main
1,348
# frozen_string_literal: true # Loads a binary file from a module or file system and returns its contents as a `Binary`. # The argument to this function should be a `<MODULE NAME>/<FILE>` # reference, which will load `<FILE>` from a module's `files` # directory. (For example, the reference `mysql/mysqltuner.pl` will l...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/chop.rb
Ruby
apache-2.0
7,843
main
1,860
# frozen_string_literal: true # Returns a new string with the last character removed. # If the string ends with `\r\n`, both characters are removed. Applying chop to an empty # string returns an empty string. If you wish to merely remove record # separators then you should use the `chomp` function. # # This function i...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/max.rb
Ruby
apache-2.0
7,843
main
7,583
# frozen_string_literal: true # Returns the highest value among a variable number of arguments. # Takes at least one argument. # # This function is (with one exception) compatible with the stdlib function # with the same name and performs deprecated type conversion before # comparison as follows: # # * If a value conv...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/json_data.rb
Ruby
apache-2.0
7,843
main
1,167
# frozen_string_literal: true # The `json_data` is a hiera 5 `data_hash` data provider function. # See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for # how to use this function. # # @since 4.8.0 # Puppet::Funct...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/group_by.rb
Ruby
apache-2.0
7,843
main
1,925
# frozen_string_literal: true # Groups the collection by result of the block. Returns a hash where the keys are the evaluated result from the block # and the values are arrays of elements in the collection that correspond to the key. Puppet::Functions.create_function(:group_by) do # @param collection A collection of...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/step.rb
Ruby
apache-2.0
7,843
main
2,986
# frozen_string_literal: true # Provides stepping with given interval over elements in an iterable and optionally runs a # [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) for each # element. # # This function takes two to three arguments: # # 1. An 'Iterable' that the function will iterate over. # 2....
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/sort.rb
Ruby
apache-2.0
7,843
main
2,574
# frozen_string_literal: true # Sorts an Array numerically or lexicographically or the characters of a String lexicographically. # Please note: This function is based on Ruby String comparison and as such may not be entirely UTF8 compatible. # To ensure compatibility please use this function with Ruby 2.4.0 or greater...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/abs.rb
Ruby
apache-2.0
7,843
main
2,170
# frozen_string_literal: true # Returns the absolute value of a Numeric value, for example -34.56 becomes # 34.56. Takes a single `Integer` or `Float` value as an argument. # # *Deprecated behavior* # # For backwards compatibility reasons this function also works when given a # number in `String` format such that it f...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/eyaml_lookup_key.rb
Ruby
apache-2.0
7,843
main
4,100
# frozen_string_literal: true # The `eyaml_lookup_key` is a hiera 5 `lookup_key` data provider function. # See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-hiera-eyaml) for # how to use this function. # # @since 5.0.0 # Puppet::Fun...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/alert.rb
Ruby
apache-2.0
7,843
main
413
# frozen_string_literal: true # Logs a message on the server at level `alert`. Puppet::Functions.create_function(:alert, Puppet::Functions::InternalFunction) do # @param values The values to log. # @return [Undef] dispatch :alert do scope_param repeated_param 'Any', :values return_type 'Undef' end ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/emerg.rb
Ruby
apache-2.0
7,843
main
413
# frozen_string_literal: true # Logs a message on the server at level `emerg`. Puppet::Functions.create_function(:emerg, Puppet::Functions::InternalFunction) do # @param values The values to log. # @return [Undef] dispatch :emerg do scope_param repeated_param 'Any', :values return_type 'Undef' end ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/length.rb
Ruby
apache-2.0
7,843
main
950
# frozen_string_literal: true # Returns the length of an Array, Hash, String, or Binary value. # # The returned value is a positive integer indicating the number # of elements in the container; counting (possibly multibyte) characters for a `String`, # bytes in a `Binary`, number of elements in an `Array`, and number ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/defined.rb
Ruby
apache-2.0
7,843
main
6,248
# frozen_string_literal: true # Determines whether a given class or resource type is defined and returns a Boolean # value. You can also use `defined` to determine whether a specific resource is defined, # or whether a variable has a value (including `undef`, as opposed to the variable never # being declared or assign...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/call.rb
Ruby
apache-2.0
7,843
main
2,265
# frozen_string_literal: true # Calls an arbitrary Puppet function by name. # # This function takes one mandatory argument and one or more optional arguments: # # 1. A string corresponding to a function name. # 2. Any number of arguments to be passed to the called function. # 3. An optional lambda, if the function bei...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/slice.rb
Ruby
apache-2.0
7,843
main
3,917
# frozen_string_literal: true # Slices an array or hash into pieces of a given size. # # This function takes two mandatory arguments: the first should be an array or hash, and the second specifies # the number of elements to include in each slice. # # When the first argument is a hash, each key value pair is counted a...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/return.rb
Ruby
apache-2.0
7,843
main
509
# frozen_string_literal: true # Makes iteration continue with the next value, optionally with a given value for this iteration. # If a value is not given it defaults to `undef` # # @since 4.7.0 # Puppet::Functions.create_function(:return, Puppet::Functions::InternalFunction) do dispatch :return_impl do optional_...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/strip.rb
Ruby
apache-2.0
7,843
main
1,735
# frozen_string_literal: true # Strips leading and trailing spaces from a String # # This function is compatible with the stdlib function with the same name. # # The function does the following: # * For a `String` the conversion removes all leading and trailing ASCII white space characters such as space, tab, newline,...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/any.rb
Ruby
apache-2.0
7,843
main
3,611
# frozen_string_literal: true # Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # repeatedly using each value in a data structure until the lambda returns a "truthy" value which # makes the function return `true`, or if the end of the iteration is reached, false is returned. # # This function ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/then.rb
Ruby
apache-2.0
7,843
main
2,652
# frozen_string_literal: true # Calls a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # with the given argument unless the argument is `undef`. # Returns `undef` if the argument is `undef`, and otherwise the result of giving the # argument to the lambda. # # This is useful to process a sequence of ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/versioncmp.rb
Ruby
apache-2.0
7,843
main
1,022
# frozen_string_literal: true require_relative '../../puppet/util/package' # Compares two version numbers. # # Prototype: # # $result = versioncmp(a, b) # # Where a and b are arbitrary version strings. # # Optional parameter ignore_trailing_zeroes is used to ignore unnecessary # trailing version numbers like .0 o...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/upcase.rb
Ruby
apache-2.0
7,843
main
2,688
# frozen_string_literal: true # Converts a String, Array or Hash (recursively) into upper case. # # This function is compatible with the stdlib function with the same name. # # The function does the following: # * For a `String`, its upper case version is returned. This is done using Ruby system locale which handles s...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/values.rb
Ruby
apache-2.0
7,843
main
718
# frozen_string_literal: true # Returns the values of a hash as an Array # # @example Using `values` # # ```puppet # $hsh = {"apples" => 3, "oranges" => 4 } # $hsh.values() # values($hsh) # # both results in the array [3, 4] # ``` # # * Note that a hash in the puppet language accepts any data value (including `undef`)...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/annotate.rb
Ruby
apache-2.0
7,843
main
4,111
# frozen_string_literal: true # Handles annotations on objects. The function can be used in four different ways. # # With two arguments, an `Annotation` type and an object, the function returns the annotation # for the object of the given type, or `undef` if no such annotation exists. # # @example Using `annotate` wit...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/lest.rb
Ruby
apache-2.0
7,843
main
1,339
# frozen_string_literal: true # Calls a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # without arguments if the value given to `lest` is `undef`. # Returns the result of calling the lambda if the argument is `undef`, otherwise the # given argument. # # The `lest` function is useful in a chain of `...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/round.rb
Ruby
apache-2.0
7,843
main
519
# frozen_string_literal: true # Returns an `Integer` value rounded to the nearest value. # Takes a single `Numeric` value as an argument. # # @example 'rounding a value' # # ```puppet # notice(round(2.9)) # would notice 3 # notice(round(2.1)) # would notice 2 # notice(round(-2.9)) # would notice -3 # ``` # Puppet::Fun...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/contain.rb
Ruby
apache-2.0
7,843
main
2,517
# frozen_string_literal: true # Makes one or more classes be contained inside the current class. # If any of these classes are undeclared, they will be declared as if # there were declared with the `include` function. # Accepts a class name, an array of class names, or a comma-separated # list of class names. # # A co...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/min.rb
Ruby
apache-2.0
7,843
main
7,536
# frozen_string_literal: true # Returns the lowest value among a variable number of arguments. # Takes at least one argument. # # This function is (with one exception) compatible with the stdlib function # with the same name and performs deprecated type conversion before # comparison as follows: # # * If a value conve...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/filter.rb
Ruby
apache-2.0
7,843
main
4,558
# frozen_string_literal: true # Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # to every value in a data structure and returns an array or hash containing any elements # for which the lambda evaluates to a truthy value (not `false` or `undef`). # # This function takes two mandatory argume...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/next.rb
Ruby
apache-2.0
7,843
main
789
# frozen_string_literal: true # Makes iteration continue with the next value, optionally with a given value for this iteration. # If a value is not given it defaults to `undef` # # @example Using the `next()` function # # ```puppet # $data = ['a','b','c'] # $data.each |Integer $index, String $value| { # if $index ==...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/hiera.rb
Ruby
apache-2.0
7,843
main
3,204
# frozen_string_literal: true require 'hiera/puppet_function' # Performs a standard priority lookup of the hierarchy and returns the most specific value # for a given key. The returned value can be any type of data. # # This function is deprecated in favor of the `lookup` function. While this function # continues to ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/join.rb
Ruby
apache-2.0
7,843
main
1,882
# frozen_string_literal: true # Joins the values of an Array into a string with elements separated by a delimiter. # # Supports up to two arguments # * **values** - first argument is required and must be an an `Array` # * **delimiter** - second arguments is the delimiter between elements, must be a `String` if given, ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/chomp.rb
Ruby
apache-2.0
7,843
main
1,559
# frozen_string_literal: true # Returns a new string with the record separator character(s) removed. # The record separator is the line ending characters `\r` and `\n`. # # This function is compatible with the stdlib function with the same name. # # The function does the following: # * For a `String` the conversion re...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/yaml_data.rb
Ruby
apache-2.0
7,843
main
1,571
# frozen_string_literal: true require 'yaml' # The `yaml_data` is a hiera 5 `data_hash` data provider function. # See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for # how to use this function. # # @since 4.8.0...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/assert_type.rb
Ruby
apache-2.0
7,843
main
3,431
# frozen_string_literal: true # Returns the given value if it is of the given # [data type](https://puppet.com/docs/puppet/latest/lang_data.html), or # otherwise either raises an error or executes an optional two-parameter # [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html). # # The function takes two ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/hocon_data.rb
Ruby
apache-2.0
7,843
main
1,388
# frozen_string_literal: true # The `hocon_data` is a hiera 5 `data_hash` data provider function. # See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for # how to use this function. # # Note that this function is ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/err.rb
Ruby
apache-2.0
7,843
main
403
# frozen_string_literal: true # Logs a message on the server at level `err`. Puppet::Functions.create_function(:err, Puppet::Functions::InternalFunction) do # @param values The values to log. # @return [Undef] dispatch :err do scope_param repeated_param 'Any', :values return_type 'Undef' end def...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/partition.rb
Ruby
apache-2.0
7,843
main
1,877
# frozen_string_literal: true # Returns two arrays, the first containing the elements of enum for which the block evaluates to true, # the second containing the rest. Puppet::Functions.create_function(:partition) do # @param collection A collection of things to partition. # @example Partition array of empty string...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/debug.rb
Ruby
apache-2.0
7,843
main
413
# frozen_string_literal: true # Logs a message on the server at level `debug`. Puppet::Functions.create_function(:debug, Puppet::Functions::InternalFunction) do # @param values The values to log. # @return [Undef] dispatch :debug do scope_param repeated_param 'Any', :values return_type 'Undef' end ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/match.rb
Ruby
apache-2.0
7,843
main
4,388
# frozen_string_literal: true # Matches a regular expression against a string and returns an array containing the match # and any matched capturing groups. # # The first argument is a string or array of strings. The second argument is either a # regular expression, regular expression represented as a string, or Regex ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/type.rb
Ruby
apache-2.0
7,843
main
2,002
# frozen_string_literal: true # Returns the data type of a given value with a given degree of generality. # # ```puppet # type InferenceFidelity = Enum[generalized, reduced, detailed] # # function type(Any $value, InferenceFidelity $fidelity = 'detailed') # returns Type # ``` # # @example Using `type` # # ``` puppet #...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/find_file.rb
Ruby
apache-2.0
7,843
main
1,693
# frozen_string_literal: true # Finds an existing file from a module and returns its path. # # This function accepts an argument that is a String as a `<MODULE NAME>/<FILE>` # reference, which searches for `<FILE>` relative to a module's `files` # directory. (For example, the reference `mysql/mysqltuner.pl` will searc...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/each.rb
Ruby
apache-2.0
7,843
main
4,994
# frozen_string_literal: true # Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # repeatedly using each value in a data structure, then returns the values unchanged. # # This function takes two mandatory arguments, in this order: # # 1. An array, hash, or other iterable object that the functio...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/get.rb
Ruby
apache-2.0
7,843
main
5,450
# frozen_string_literal: true # Digs into a value with dot notation to get a value from within a structure. # # **To dig into a given value**, call the function with (at least) two arguments: # # * The **first** argument must be an Array, or Hash. Value can also be `undef` # (which also makes the result `undef` unle...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/crit.rb
Ruby
apache-2.0
7,843
main
408
# frozen_string_literal: true # Logs a message on the server at level `crit`. Puppet::Functions.create_function(:crit, Puppet::Functions::InternalFunction) do # @param values The values to log. # @return [Undef] dispatch :crit do scope_param repeated_param 'Any', :values return_type 'Undef' end ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/notice.rb
Ruby
apache-2.0
7,843
main
418
# frozen_string_literal: true # Logs a message on the server at level `notice`. Puppet::Functions.create_function(:notice, Puppet::Functions::InternalFunction) do # @param values The values to log. # @return [Undef] dispatch :notice do scope_param repeated_param 'Any', :values return_type 'Undef' e...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/dig.rb
Ruby
apache-2.0
7,843
main
2,447
# frozen_string_literal: true # Returns a value for a sequence of given keys/indexes into a structure, such as # an array or hash. # # This function is used to "dig into" a complex data structure by # using a sequence of keys / indexes to access a value from which # the next key/index is accessed recursively. # # The ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/all.rb
Ruby
apache-2.0
7,843
main
3,187
# frozen_string_literal: true # Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # repeatedly using each value in a data structure until the lambda returns a non "truthy" value which # makes the function return `false`, or if the end of the iteration is reached, `true` is returned. # # This fun...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/map.rb
Ruby
apache-2.0
7,843
main
3,817
# frozen_string_literal: true # Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # to every value in a data structure and returns an array containing the results. # # This function takes two mandatory arguments, in this order: # # 1. An array, hash, or other iterable object that the function...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/warning.rb
Ruby
apache-2.0
7,843
main
423
# frozen_string_literal: true # Logs a message on the server at level `warning`. Puppet::Functions.create_function(:warning, Puppet::Functions::InternalFunction) do # @param values The values to log. # @return [Undef] dispatch :warning do scope_param repeated_param 'Any', :values return_type 'Undef' ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/ceiling.rb
Ruby
apache-2.0
7,843
main
1,212
# frozen_string_literal: true # Returns the smallest `Integer` greater or equal to the argument. # Takes a single numeric value as an argument. # # This function is backwards compatible with the same function in stdlib # and accepts a `Numeric` value. A `String` that can be converted # to a floating point number can a...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/info.rb
Ruby
apache-2.0
7,843
main
408
# frozen_string_literal: true # Logs a message on the server at level `info`. Puppet::Functions.create_function(:info, Puppet::Functions::InternalFunction) do # @param values The values to log. # @return [Undef] dispatch :info do scope_param repeated_param 'Any', :values return_type 'Undef' end ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/index.rb
Ruby
apache-2.0
7,843
main
5,615
# frozen_string_literal: true # Returns the index (or key in a hash) to a first-found value in an `Iterable` value. # # When called with a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) # the lambda is called repeatedly using each value in a data structure until the lambda returns a "truthy" value ...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/import.rb
Ruby
apache-2.0
7,843
main
295
# frozen_string_literal: true # The import function raises an error when called to inform the user that import is no longer supported. # Puppet::Functions.create_function(:import) do def import(*args) raise Puppet::Pops::SemanticError, Puppet::Pops::Issues::DISCONTINUED_IMPORT end end
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/find_template.rb
Ruby
apache-2.0
7,843
main
2,097
# frozen_string_literal: true # Finds an existing template from a module and returns its path. # # This function accepts an argument that is a String as a `<MODULE NAME>/<TEMPLATE>` # reference, which searches for `<TEMPLATE>` relative to a module's `templates` # directory on the primary server. (For example, the refe...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/new.rb
Ruby
apache-2.0
7,843
main
37,284
# frozen_string_literal: true # Creates a new instance/object of a given data type. # # This function makes it possible to create new instances of # concrete data types. If a block is given it is called with the # just created instance as an argument. # # Calling this function is equivalent to directly # calling the d...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/break.rb
Ruby
apache-2.0
7,843
main
1,282
# frozen_string_literal: true # Breaks an innermost iteration as if it encountered an end of input. # This function does not return to the caller. # # The signal produced to stop the iteration bubbles up through # the call stack until either terminating the innermost iteration or # raising an error if the end of the c...
github
puppetlabs/puppet
https://github.com/puppetlabs/puppet
lib/puppet/functions/empty.rb
Ruby
apache-2.0
7,843
main
2,076
# frozen_string_literal: true # Returns `true` if the given argument is an empty collection of values. # # This function can answer if one of the following is empty: # * `Array`, `Hash` - having zero entries # * `String`, `Binary` - having zero length # # For backwards compatibility with the stdlib function with the s...