Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: panthomakos/sham
base: 633cac7d28
...
head fork: panthomakos/sham
compare: b3037a6dd3
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jul 10, 2012
@panthomakos Add HashOptions module to reduce duplication.
This code was fully duplicated in the configuration classes. The option
specification is the same, so I've moved the code into its own module.
90685ca
@panthomakos Added CodeClimate badge to README. 1eee292
@panthomakos Add Rake to gemspec development dependencies. 23053c5
@panthomakos Revert "Add Rake to gemspec development dependencies."
This reverts commit 23053c5.
ad0492d
@panthomakos Move Rake to Gemspec. b3037a6
View
2  Gemfile
@@ -1,5 +1,3 @@
source "http://rubygems.org"
gemspec
-
-gem 'rake'
View
2  README.markdown
@@ -239,3 +239,5 @@ with Spork. If you take this approach it's important to remove the call to
`Sham::Config.activate!` from your `test.rb` file.
## Build Status [![Build Status](https://secure.travis-ci.org/panthomakos/sham.png)](http://travis-ci.org/panthomakos/sham)
+
+## Code Quality [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/panthomakos/sham)
View
14 lib/sham/config/assign.rb
@@ -1,9 +1,11 @@
require 'sham/config/base'
-require 'sham/util'
+require 'sham/config/hash_options'
module Sham
class Config
class Assign < Base
+ include HashOptions
+
def initialize(config)
@config = config
end
@@ -22,16 +24,6 @@ def sham(build = false)
object
end
- def options(*args)
- @options = ::Sham::Util.extract_options!(args)
-
- @config.call.each do |key, value|
- @options[key] = parse!(value) unless @options.has_key?(key)
- end
-
- self
- end
-
def args
[]
end
View
14 lib/sham/config/attributes.rb
@@ -1,23 +1,15 @@
require 'sham/config/base'
-require 'sham/util'
+require 'sham/config/hash_options'
module Sham
class Config
class Attributes < Base
+ include HashOptions
+
def initialize(config)
@config = config
end
- def options(*args)
- @options = ::Sham::Util.extract_options!(args)
-
- @config.call.each do |key, value|
- @options[key] = parse!(value) unless @options.has_key?(key)
- end
-
- self
- end
-
def args
[@options]
end
View
17 lib/sham/config/hash_options.rb
@@ -0,0 +1,17 @@
+require 'sham/util'
+
+module Sham
+ class Config
+ module HashOptions
+ def options(*args)
+ @options = ::Sham::Util.extract_options!(args)
+
+ @config.call.each do |key, value|
+ @options[key] = parse!(value) unless @options.has_key?(key)
+ end
+
+ self
+ end
+ end
+ end
+end
View
1  sham.gemspec
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.add_development_dependency('rspec')
+ s.add_development_dependency('rake')
end

No commit comments for this range

Something went wrong with that request. Please try again.