Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #37 from robertomiranda/roberto/improving_code_style

Improving conditional statements
  • Loading branch information...
commit 52722f129bcb1dbd4f3f774147d34163640338d8 2 parents ea15363 + 5750910
@binarylogic authored
Showing with 7 additions and 18 deletions.
  1. +1 −0  .gitignore
  2. +6 −18 lib/settingslogic.rb
View
1  .gitignore
@@ -7,3 +7,4 @@ doc/*
benchmarks/*
.bundle
vendor/bundle
+.rvmrc
View
24 lib/settingslogic.rb
@@ -22,27 +22,15 @@ def get(key)
end
def source(value = nil)
- if value.nil?
- @source
- else
- @source = value
- end
+ @source ||= value
end
def namespace(value = nil)

Hi,
This change broke reassignment of the namespace, which prevents rereading/reloading a yml file with a different namespace than the default. Can these please be reverted to what it is in this version? 52722f1

This applies to #source, #namespace, and #suppress_errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- if value.nil?
- @namespace
- else
- @namespace = value
- end
+ @namespace ||= value
end
def suppress_errors(value = nil)
- if value.nil?
- @suppress_errors
- else
- @suppress_errors = value
- end
+ @suppress_errors ||= value
end
def [](key)
@@ -60,12 +48,12 @@ def load!
instance
true
end
-
+
def reload!
@instance = nil
load!
end
-
+
private
def instance
return @instance if @instance
@@ -73,7 +61,7 @@ def instance
create_accessors!
@instance
end
-
+
def method_missing(name, *args, &block)
instance.send(name, *args, &block)
end
Please sign in to comment.
Something went wrong with that request. Please try again.