diff options
43 files changed, 55 insertions, 55 deletions
diff --git a/lib/puppet/agent.rb b/lib/puppet/agent.rb index 6682b8450..58bf5cd42 100644 --- a/lib/puppet/agent.rb +++ b/lib/puppet/agent.rb @@ -81,7 +81,7 @@ class Puppet::Agent end def sync - @sync = Sync.new unless @sync + @sync ||= Sync.new @sync end diff --git a/lib/puppet/agent/locker.rb b/lib/puppet/agent/locker.rb index c49121e1b..52f3002af 100644 --- a/lib/puppet/agent/locker.rb +++ b/lib/puppet/agent/locker.rb @@ -29,7 +29,7 @@ module Puppet::Agent::Locker end def lockfile - @lockfile = Puppet::Util::Pidlock.new(lockfile_path) unless defined?(@lockfile) + @lockfile ||= Puppet::Util::Pidlock.new(lockfile_path) @lockfile end diff --git a/lib/puppet/external/nagios/parser.rb b/lib/puppet/external/nagios/parser.rb index 7e83f0346..934af146e 100644 --- a/lib/puppet/external/nagios/parser.rb +++ b/lib/puppet/external/nagios/parser.rb @@ -70,9 +70,9 @@ module Racc def _racc_setup @yydebug = false unless self.class::Racc_debug_parser - @yydebug = false unless defined?(@yydebug) + @yydebug ||= false if @yydebug - @racc_debug_out = $stderr unless defined?(@racc_debug_out) + @racc_debug_out ||= $stderr @racc_debug_out ||= $stderr end arg = self.class::Racc_arg diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb index 0871c4aa7..707713082 100644 --- a/lib/puppet/file_serving/base.rb +++ b/lib/puppet/file_serving/base.rb @@ -67,7 +67,7 @@ class Puppet::FileServing::Base # Stat our file, using the appropriate link-sensitive method. def stat - @stat_method = self.links == :manage ? :lstat : :stat unless defined?(@stat_method) + @stat_method ||= self.links == :manage ? :lstat : :stat File.send(@stat_method, full_path()) end diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb index 99bd8407c..15d9f9a22 100644 --- a/lib/puppet/file_serving/fileset.rb +++ b/lib/puppet/file_serving/fileset.rb @@ -158,7 +158,7 @@ class Puppet::FileServing::Fileset public # Stat a given file, using the links-appropriate method. def stat(path) - @stat_method = self.links == :manage ? :lstat : :stat unless defined?(@stat_method) + @stat_method ||= self.links == :manage ? :lstat : :stat begin return File.send(@stat_method, path) diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index 8eaaf26d6..282762889 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -64,7 +64,7 @@ class Puppet::Indirector::Indirection # Default to the runinterval for the ttl. def ttl - @ttl = Puppet[:runinterval].to_i unless defined?(@ttl) + @ttl ||= Puppet[:runinterval].to_i @ttl end diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb index 32494e18c..faf9a1398 100644 --- a/lib/puppet/indirector/request.rb +++ b/lib/puppet/indirector/request.rb @@ -21,7 +21,7 @@ class Puppet::Indirector::Request end def environment - @environment = Puppet::Node::Environment.new() unless @environment + @environment ||= Puppet::Node::Environment.new() @environment end @@ -69,7 +69,7 @@ class Puppet::Indirector::Request if key_or_instance.is_a?(String) || key_or_instance.is_a?(Symbol) key = key_or_instance else - @instance = key_or_instance if ! @instance + @instance ||= key_or_instance end if key diff --git a/lib/puppet/network/authconfig.rb b/lib/puppet/network/authconfig.rb index 8c2ad5857..b058012f5 100644 --- a/lib/puppet/network/authconfig.rb +++ b/lib/puppet/network/authconfig.rb @@ -6,7 +6,7 @@ module Puppet class Network::AuthConfig < Puppet::Util::LoadedFile def self.main - @main = self.new() unless defined?(@main) + @main ||= self.new() @main end diff --git a/lib/puppet/network/authorization.rb b/lib/puppet/network/authorization.rb index 136875392..3d47ea315 100644 --- a/lib/puppet/network/authorization.rb +++ b/lib/puppet/network/authorization.rb @@ -10,7 +10,7 @@ module Puppet::Network # Create our config object if necessary. This works even if # there's no configuration file. def authconfig - @authconfig = Puppet::Network::AuthConfig.main() unless defined?(@authconfig) + @authconfig ||= Puppet::Network::AuthConfig.main() @authconfig end diff --git a/lib/puppet/network/client.rb b/lib/puppet/network/client.rb index 258e577cd..1d720ccdb 100644 --- a/lib/puppet/network/client.rb +++ b/lib/puppet/network/client.rb @@ -48,19 +48,19 @@ class Puppet::Network::Client # Determine what clients look for when being passed an object for local # client/server stuff. E.g., you could call Client::CA.new(:CA => ca). def self.drivername - @drivername = self.name unless defined?(@drivername) + @drivername ||= self.name @drivername end # Figure out the handler for our client. def self.handler - @handler = Puppet::Network::Handler.handler(self.name) unless defined?(@handler) + @handler ||= Puppet::Network::Handler.handler(self.name) @handler end # The class that handles xmlrpc interaction for us. def self.xmlrpc_client - @xmlrpc_client = Puppet::Network::XMLRPCClient.handler_class(self.handler) unless defined?(@xmlrpc_client) + @xmlrpc_client ||= Puppet::Network::XMLRPCClient.handler_class(self.handler) @xmlrpc_client end diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb index efd71223f..1131e434a 100755 --- a/lib/puppet/network/handler/fileserver.rb +++ b/lib/puppet/network/handler/fileserver.rb @@ -701,7 +701,7 @@ class Puppet::Network::Handler if modpath = mod.plugin(relpath) if FileTest.directory?(modpath) and recurse ary = reclist(modpath, recurse, ignore) - ary = [] if ary.nil? + ary ||= [] result += ary else result += [["/", File.stat(modpath).ftype]] diff --git a/lib/puppet/network/rest_authorization.rb b/lib/puppet/network/rest_authorization.rb index 3c7c98a21..d9a837050 100644 --- a/lib/puppet/network/rest_authorization.rb +++ b/lib/puppet/network/rest_authorization.rb @@ -9,7 +9,7 @@ module Puppet::Network # Create our config object if necessary. If there's no configuration file # we install our defaults def authconfig - @authconfig = Puppet::Network::RestAuthConfig.main unless defined?(@authconfig) + @authconfig ||= Puppet::Network::RestAuthConfig.main @authconfig end diff --git a/lib/puppet/network/xmlrpc/client.rb b/lib/puppet/network/xmlrpc/client.rb index 2bf30e729..5bcd5fbc9 100644 --- a/lib/puppet/network/xmlrpc/client.rb +++ b/lib/puppet/network/xmlrpc/client.rb @@ -150,7 +150,7 @@ module Puppet::Network end def http - @http = Puppet::Network::HttpPool.http_instance(host, port, true) unless @http + @http ||= Puppet::Network::HttpPool.http_instance(host, port, true) @http end diff --git a/lib/puppet/network/xmlrpc/webrick_servlet.rb b/lib/puppet/network/xmlrpc/webrick_servlet.rb index e7fb2ae9c..890f2990e 100644 --- a/lib/puppet/network/xmlrpc/webrick_servlet.rb +++ b/lib/puppet/network/xmlrpc/webrick_servlet.rb @@ -10,7 +10,7 @@ module Puppet::Network::XMLRPC # This is a hackish way to avoid an auth message every time we have a # normal operation def self.log(msg) - @logs = {} unless defined?(@logs) + @logs ||= {} if @logs.include?(msg) @logs[msg] += 1 else diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb index 54e71dd41..b3ec1717a 100644 --- a/lib/puppet/parameter.rb +++ b/lib/puppet/parameter.rb @@ -203,7 +203,7 @@ class Puppet::Parameter # for testing whether we should actually do anything def noop - @noop = false unless defined?(@noop) + @noop ||= false tmp = @noop || self.resource.noop || Puppet[:noop] || false #debug "noop is #{tmp}" tmp diff --git a/lib/puppet/parser/ast/branch.rb b/lib/puppet/parser/ast/branch.rb index 0be6ca018..96d065e4c 100644 --- a/lib/puppet/parser/ast/branch.rb +++ b/lib/puppet/parser/ast/branch.rb @@ -23,7 +23,7 @@ class Puppet::Parser::AST super(arghash) # Create the hash, if it was not set at initialization time. - @children = [] unless defined?(@children) + @children ||= [] # Verify that we only got valid AST nodes. @children.each { |child| diff --git a/lib/puppet/parser/ast/caseopt.rb b/lib/puppet/parser/ast/caseopt.rb index b18a40320..6cf36f94c 100644 --- a/lib/puppet/parser/ast/caseopt.rb +++ b/lib/puppet/parser/ast/caseopt.rb @@ -29,7 +29,7 @@ class Puppet::Parser::AST @default = true if @value.is_a?(AST::Default) end - @default = false unless defined?(@default) + @default ||= false @default end diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 65d657b63..ba2a5f3b0 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -27,7 +27,7 @@ class Puppet::Parser::Resource < Puppet::Resource # Determine whether the provided parameter name is a relationship parameter. def self.relationship_parameter?(name) - @relationship_names = Puppet::Type.relationship_params.collect { |p| p.name } unless defined?(@relationship_names) + @relationship_names ||= Puppet::Type.relationship_params.collect { |p| p.name } @relationship_names.include?(name) end diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb index 0ded4c557..ba4c2693e 100644 --- a/lib/puppet/property.rb +++ b/lib/puppet/property.rb @@ -21,7 +21,7 @@ class Puppet::Property < Puppet::Parameter # Return array matching info, defaulting to just matching # the first value. def array_matching - @array_matching = :first unless defined?(@array_matching) + @array_matching ||= :first @array_matching end diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb index e7a241aaa..937f114d6 100644 --- a/lib/puppet/provider.rb +++ b/lib/puppet/provider.rb @@ -174,7 +174,7 @@ class Puppet::Provider # Retrieve the data source. Defaults to the provider name. def self.source - @source = self.name unless defined?(@source) + @source ||= self.name @source end diff --git a/lib/puppet/provider/confine/variable.rb b/lib/puppet/provider/confine/variable.rb index 504c6a0c9..9dde40aab 100644 --- a/lib/puppet/provider/confine/variable.rb +++ b/lib/puppet/provider/confine/variable.rb @@ -18,7 +18,7 @@ class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine # Retrieve the value from facter def facter_value - @facter_value = ::Facter.value(name).to_s.downcase unless @facter_value + @facter_value ||= ::Facter.value(name).to_s.downcase @facter_value end diff --git a/lib/puppet/provider/confiner.rb b/lib/puppet/provider/confiner.rb index bb26ea46b..012eaa888 100644 --- a/lib/puppet/provider/confiner.rb +++ b/lib/puppet/provider/confiner.rb @@ -6,7 +6,7 @@ module Puppet::Provider::Confiner end def confine_collection - @confine_collection = Puppet::Provider::ConfineCollection.new(self.to_s) unless defined?(@confine_collection) + @confine_collection ||= Puppet::Provider::ConfineCollection.new(self.to_s) @confine_collection end diff --git a/lib/puppet/provider/macauthorization/macauthorization.rb b/lib/puppet/provider/macauthorization/macauthorization.rb index 22186de42..4c55d7280 100644 --- a/lib/puppet/provider/macauthorization/macauthorization.rb +++ b/lib/puppet/provider/macauthorization/macauthorization.rb @@ -157,7 +157,7 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe cmds << :security << "authorizationdb" << "read" << resource[:name] output = execute(cmds, :combine => false) current_values = Plist::parse_xml(output) - current_values = {} if current_values.nil? + current_values ||= {} specified_values = convert_plist_to_native_attributes(@property_hash) # take the current values, merge the specified values to obtain a diff --git a/lib/puppet/provider/mcx/mcxcontent.rb b/lib/puppet/provider/mcx/mcxcontent.rb index 97a778ffe..4711413f8 100644 --- a/lib/puppet/provider/mcx/mcxcontent.rb +++ b/lib/puppet/provider/mcx/mcxcontent.rb @@ -140,11 +140,11 @@ Puppet::Type.type(:mcx).provide :mcxcontent, :parent => Puppet::Provider do # This is a private instance method, not a class method. def get_dsparams ds_type = resource[:ds_type] - ds_type = parse_type(resource[:name]) if ds_type.nil? + ds_type ||= parse_type(resource[:name]) raise MCXContentProviderException unless TypeMap.keys.include? ds_type.to_sym ds_name = resource[:ds_name] - ds_name = parse_name(resource[:name]) if ds_name.nil? + ds_name ||= parse_name(resource[:name]) rval = { :ds_type => ds_type.to_sym, diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb index cdbcdd05d..53585b191 100755 --- a/lib/puppet/provider/parsedfile.rb +++ b/lib/puppet/provider/parsedfile.rb @@ -34,7 +34,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider end def self.filetype - @filetype = Puppet::Util::FileType.filetype(:flat) unless defined?(@filetype) + @filetype ||= Puppet::Util::FileType.filetype(:flat) @filetype end @@ -79,7 +79,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider def self.backup_target(target) return nil unless target_object(target).respond_to?(:backup) - @backup_stats = {} unless defined?(@backup_stats) + @backup_stats ||= {} return nil if @backup_stats[target] == @records.object_id target_object(target).backup diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb index 0b1bd873e..c93f13e02 100644 --- a/lib/puppet/reports/rrdgraph.rb +++ b/lib/puppet/reports/rrdgraph.rb @@ -22,7 +22,7 @@ Puppet::Reports.register_report(:rrdgraph) do which defaults to the ``runinterval``." def hostdir - @hostdir = File.join(Puppet[:rrddir], self.host) unless defined?(@hostdir) + @hostdir ||= File.join(Puppet[:rrddir], self.host) @hostdir end diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 18bca611c..027b0fb92 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -119,7 +119,7 @@ class Puppet::SimpleGraph def dependencies(resource) # Cache the reversal graph, because it's somewhat expensive # to create. - @reversal = reversal unless @reversal + @reversal ||= reversal # Strangely, it's significantly faster to search a reversed # tree in the :out direction than to search a normal tree # in the :in direction. diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb index 357e54e9f..00dbf60a1 100644 --- a/lib/puppet/ssl/certificate_authority.rb +++ b/lib/puppet/ssl/certificate_authority.rb @@ -148,7 +148,7 @@ class Puppet::SSL::CertificateAuthority # Retrieve (or create, if necessary) our inventory manager. def inventory - @inventory = Puppet::SSL::Inventory.new unless defined?(@inventory) + @inventory ||= Puppet::SSL::Inventory.new @inventory end diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb index b97817c85..74c1bbf6a 100644 --- a/lib/puppet/transportable.rb +++ b/lib/puppet/transportable.rb @@ -34,7 +34,7 @@ module Puppet end def ref - @ref = Puppet::Resource.new(@type, @name) unless defined?(@ref) + @ref ||= Puppet::Resource.new(@type, @name) @ref.to_s end @@ -239,7 +239,7 @@ module Puppet end def param(param,value) - @parameters = {} unless defined?(@parameters) + @parameters ||= {} @parameters[param] = value end diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 47e015168..7aab88c9c 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1624,7 +1624,7 @@ class Type @defaults = {} - @parameters = [] unless defined?(@parameters) + @parameters ||= [] @validproperties = {} @properties = [] @@ -1642,7 +1642,7 @@ class Type end } - @doc = "" unless defined?(@doc) + @doc ||= "" end diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb index 856ea7cc9..7a1f37f1d 100755 --- a/lib/puppet/type/cron.rb +++ b/lib/puppet/type/cron.rb @@ -387,7 +387,7 @@ Puppet::Type.newtype(:cron) do if obj = @parameters[name] ret = obj.should - ret = obj.retrieve if ret.nil? + ret ||= obj.retrieve if ret == :absent ret = nil diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index fdcd2c80c..e1a23dd13 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -112,7 +112,7 @@ module Puppet def insync?(is) @should ||= [] - @latest = nil unless defined?(@latest) + @latest ||= nil @lateststamp ||= (Time.now.to_i - 1000) # Iterate across all of the should values, and see how they # turn out. diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb index fc7109c38..76685d6bd 100644 --- a/lib/puppet/type/resources.rb +++ b/lib/puppet/type/resources.rb @@ -68,8 +68,8 @@ Puppet::Type.newtype(:resources) do end def check(resource) - @checkmethod = "#{self[:name]}_check" unless defined?(@checkmethod) - @hascheck = respond_to?(@checkmethod) unless defined?(@hascheck) + @checkmethod ||= "#{self[:name]}_check" + @hascheck ||= respond_to?(@checkmethod) if @hascheck return send(@checkmethod, resource) else diff --git a/lib/puppet/util/cacher.rb b/lib/puppet/util/cacher.rb index 8a0acc82f..df8c28a7d 100644 --- a/lib/puppet/util/cacher.rb +++ b/lib/puppet/util/cacher.rb @@ -88,7 +88,7 @@ module Puppet::Util::Cacher private def cache_timestamp - @cache_timestamp = Time.now unless defined?(@cache_timestamp) + @cache_timestamp ||= Time.now @cache_timestamp end @@ -122,7 +122,7 @@ module Puppet::Util::Cacher end def value_cache - @value_cache = {} unless @value_cache + @value_cache ||= {} @value_cache end end diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb index a5d7ca4ab..bc3555915 100644 --- a/lib/puppet/util/fileparsing.rb +++ b/lib/puppet/util/fileparsing.rb @@ -203,7 +203,7 @@ module Puppet::Util::FileParsing end def line_separator - @line_separator = "\n" unless defined?(@line_separator) + @line_separator ||= "\n" @line_separator end diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 712895f1f..98aaf8cc1 100755 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -72,7 +72,7 @@ class Puppet::Util::FileType # Pick or create a filebucket to use. def bucket - @bucket = Puppet::Type.type(:filebucket).mkdefaultbucket.bucket unless defined?(@bucket) + @bucket ||= Puppet::Type.type(:filebucket).mkdefaultbucket.bucket @bucket end diff --git a/lib/puppet/util/inline_docs.rb b/lib/puppet/util/inline_docs.rb index b04b40a22..95a8c2ac0 100644 --- a/lib/puppet/util/inline_docs.rb +++ b/lib/puppet/util/inline_docs.rb @@ -15,7 +15,7 @@ module Puppet::Util::InlineDocs attr_writer :doc def doc - @doc = "" unless @doc + @doc ||= "" @doc end diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb index 6c94247ea..515568c93 100644 --- a/lib/puppet/util/log/destinations.rb +++ b/lib/puppet/util/log/destinations.rb @@ -154,7 +154,7 @@ Puppet::Util::Log.newdesttype :host do def handle(msg) unless msg.is_a?(String) or msg.remote - @hostname = Facter["hostname"].value unless defined?(@hostname) + @hostname ||= Facter["hostname"].value unless defined?(@domain) @domain = Facter["domain"].value @hostname += ".#{@domain}" if @domain diff --git a/lib/puppet/util/log_paths.rb b/lib/puppet/util/log_paths.rb index a7ad18906..e09ceb7fa 100644 --- a/lib/puppet/util/log_paths.rb +++ b/lib/puppet/util/log_paths.rb @@ -5,7 +5,7 @@ module Puppet::Util::LogPaths # return the full path to us, for logging and rollback # some classes (e.g., FileTypeRecords) will have to override this def path - @path = pathbuilder unless defined?(@path) + @path ||= pathbuilder "/" + @path.join("/") end diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index c79adf671..606d06cdd 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -67,7 +67,7 @@ class Parser names.each do |name| prev_container = container container = find_object_named(container, name) - container = prev_container.add_class(PuppetClass, name, nil) unless container + container ||= prev_container.add_class(PuppetClass, name, nil) end [container, final_name] end diff --git a/lib/puppet/util/subclass_loader.rb b/lib/puppet/util/subclass_loader.rb index 6f861439a..ee6b68b15 100644 --- a/lib/puppet/util/subclass_loader.rb +++ b/lib/puppet/util/subclass_loader.rb @@ -68,7 +68,7 @@ module Puppet::Util::SubclassLoader # Retrieve or calculate a name. def name(dummy_argument=:work_arround_for_ruby_GC_bug) - @name = self.to_s.sub(/.+::/, '').intern unless defined?(@name) + @name ||= self.to_s.sub(/.+::/, '').intern @name end diff --git a/test/lib/puppettest/filetesting.rb b/test/lib/puppettest/filetesting.rb index 6f07c2ad4..79981ce9c 100644 --- a/test/lib/puppettest/filetesting.rb +++ b/test/lib/puppettest/filetesting.rb @@ -32,9 +32,9 @@ module PuppetTest::FileTesting def mkranddirsandfiles(dirs = nil,files = nil,depth = 3) return if depth < 0 - dirs = %w{This Is A Set Of Directories} unless dirs + dirs ||= %w{This Is A Set Of Directories} - files = %w{and this is a set of files} unless files + files ||= %w{and this is a set of files} tfiles = randlist(files) tdirs = randlist(dirs) diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb index 3dfac96e6..41d12c8db 100755 --- a/test/ral/providers/cron/crontab.rb +++ b/test/ral/providers/cron/crontab.rb @@ -23,7 +23,7 @@ class TestCronParsedProvider < Test::Unit::TestCase # a full cron job. These tests assume individual record types will always be correctly # parsed, so all they def sample_crons - @sample_crons = YAML.load(File.read(File.join(@crondir, "crontab_collections.yaml"))) unless defined?(@sample_crons) + @sample_crons ||= YAML.load(File.read(File.join(@crondir, "crontab_collections.yaml"))) @sample_crons end @@ -31,7 +31,7 @@ class TestCronParsedProvider < Test::Unit::TestCase # mapping between records and lines. We have plenty of redundancy here because # we use these records to build up our complex, multi-line cron jobs below. def sample_records - @sample_records = YAML.load(File.read(File.join(@crondir, "crontab_sample_records.yaml"))) unless defined?(@sample_records) + @sample_records ||= YAML.load(File.read(File.join(@crondir, "crontab_sample_records.yaml"))) @sample_records end |