From 946e614a5156561f6f6457b1597e13d46cd56d5c Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Mon, 31 Oct 2011 00:30:35 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- lib/schrodingers_cat.rb | 4 ++-- lib/schrodingers_cat/core_ext.rb | 12 ++++++------ lib/schrodingers_cat/dependencies.rb | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/schrodingers_cat.rb b/lib/schrodingers_cat.rb index 41f848d..0ba8302 100644 --- a/lib/schrodingers_cat.rb +++ b/lib/schrodingers_cat.rb @@ -38,7 +38,7 @@ def initialize(original, attrs={}) class_eval %{ def #{meth}; MODEL_OBJECT.#{meth}; end; } end #delegate *[ 'inspect', 'to_s', 'to_i', 'nil?', 'empty?' ,'blank?' ].map(&:intern), :to => :MODEL_OBJECT - + if Rails.env.development? def inspect; "nil (SchrodingersCat)"; end end @@ -47,7 +47,7 @@ def inspect; "nil (SchrodingersCat)"; end class_eval %{ def #{meth}(other); MODEL_OBJECT.#{meth}(other); end; } end #delegate *[ "==", "eql?", "&", "^", "|" ].map(&:intern), :to => :MODEL_OBJECT - + def dup; nil; end def method_missing(method_sym, *arguments, &block) diff --git a/lib/schrodingers_cat/core_ext.rb b/lib/schrodingers_cat/core_ext.rb index f97ee7d..0d2322f 100644 --- a/lib/schrodingers_cat/core_ext.rb +++ b/lib/schrodingers_cat/core_ext.rb @@ -52,7 +52,7 @@ def only_unless_a?(*others, &block) def assuming_a(*others, &block) if_a?(*others.merge_options(:chain => true), &block) end - + ################################## # Exact comparison of #== in is_one_of? rather than utilizing #=== in #is_one_kind_of ############################### @@ -61,7 +61,7 @@ def unless_equals_a?(*others, &block); if_equals_a?(*others.merge_optio def only_if_equals_a?(*others, &block); if_equals_a?(*others.merge_options(:else => nil), &block); end def only_unless_equals_a?(*others, &block); unless_equals_a?(*others.merge_options(:else => nil), &block); end def assuming_equals_a(*others, &block); if_equals_a?(*others.merge_options(:chain => true), &block); end - + ######################### # Custom conditionals. ## ######################### @@ -69,18 +69,18 @@ def if?(varied, *args, &block) if_a?(*args.merge_options(:conditions => res def unless?(*args, &block); if?(*args.merge_options(:opposite => true), &block); end def only_if?(*args, &block); if?(*args.merge_options(:else => nil), &block); end def only_unless?(*args, &block); only_if?(*args.merge_options(:opposite => true), &block); end - #def assuming(*args, &block); if?(*args.merge_options(:chain => true), &block); end - + #def assuming(*args, &block); if?(*args.merge_options(:chain => true), &block); end + ######################### # Utilities ## ######################### def present_else_nil; present_else(nil); end def significant_else_nil; significant_else(nil); end - + protected def present_else(other); if?(:present?, :else => other) { self }; end def significant_else(other); if?(:significant?, :else => other) { self }; end - + private def resolve_conditions(varied) varied.is_a?(Symbol) ? __send__(varied) : varied.is_a?(Array) ? __send__(*varied) : varied.is_a?(String) ? varied[0] =~ /\./ ? __send__(:eval, "self#{varied}") : eval(varied) : !!varied diff --git a/lib/schrodingers_cat/dependencies.rb b/lib/schrodingers_cat/dependencies.rb index a34547a..f514824 100644 --- a/lib/schrodingers_cat/dependencies.rb +++ b/lib/schrodingers_cat/dependencies.rb @@ -2,7 +2,7 @@ class Array def options_extractable? last.is_a?(Hash) && last.extractable_options? end - + def flatten_splat(with_bang=false) flatten_splat_needed? ? with_bang ? flatten! : flatten : self end @@ -10,12 +10,12 @@ def flatten_splat(with_bang=false) def flatten_splat! flatten_splat(true) end - + def flatten_splat_needed? self.size == 1 and first.is_a?(Array) end private :flatten_splat_needed? - + def merge_options(update_hash={}) endex, base_hash = options_extractable? ? [ -2, last ] : [ -1, {} ] Array[ *self[0..endex], base_hash.merge(update_hash || {}) ] @@ -24,5 +24,5 @@ def merge_options(update_hash={}) def merge_options!(update_hash={}) push(extract_options!(update_hash)) end; alias_method :merge_opts!, :merge_options! - + end \ No newline at end of file