Skip to content

Commit

Permalink
Minor API change
Browse files Browse the repository at this point in the history
  • Loading branch information
sagmor committed Jan 19, 2012
1 parent 840a6f5 commit b1ed16f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -12,16 +12,20 @@ This is currently under revision so the gem's API might change
Just include this gem in your Gemfile

```ruby
gem 'sprockets'
# Gemfile
gem 'strockets'
```

### Others

After adding the gem to your Gemfile, register Strockets on your sprockets environment:
Add the gem to your Gemfile and register Strockets on your sprockets environment:

```ruby
env.append_path Strockets.stitch_path
# Gemfile
gem 'strockets'

# initializer_file.rb
env.append_path Strockets.stitch_path
env.register_postprocessor(
'application/javascript',
Strockets::StitchPostprocessor
Expand All @@ -43,5 +47,5 @@ But you can force the stitching of a file by adding a directive to your file's h
Strockets has the following options:

* `Strockets.namespace`: Which namespace to use
* `Strockets.default_to_stitch`: Default Action (to stitch or not to stitch)
* `Strockets.defaults_to_stitch`: Default Action (to stitch or not to stitch)
* `Strockets.stitch_exceptions`: Which files shouldn't follow the default action
12 changes: 6 additions & 6 deletions lib/strockets/config.rb
Expand Up @@ -11,18 +11,18 @@ def namespace=(namespace)
@namespace = namespace
end

def default_to_stitch?
@default_to_stitch || true
def defaults_to_stitch?
@defaults_to_stitch || true
end
alias_method :default_to_stitch, :default_to_stitch?
alias_method :defaults_to_stitch, :defaults_to_stitch?

def default_to_stitch=(default)
@stitch_by_default = default
def defaults_to_stitch=(default)
@defaults_to_stitch = default
end

def stitch_exceptions
@stitch_exceptions ||
default_to_stitch? ? STITCH_EXCEPTIONS_ON_TRUE : STITCH_EXCEPTIONS_ON_FALSE
defaults_to_stitch? ? STITCH_EXCEPTIONS_ON_TRUE : STITCH_EXCEPTIONS_ON_FALSE
end

def stitch_exceptions=(stitch_exceptions)
Expand Down
2 changes: 1 addition & 1 deletion lib/strockets/stitch_postprocessor.rb
Expand Up @@ -22,7 +22,7 @@ def stitch?
stitch = directive?

if stitch.nil?
stitch = Strockets.default_to_stitch?
stitch = Strockets.defaults_to_stitch?
stitch = !stitch if exception?
end

Expand Down

0 comments on commit b1ed16f

Please sign in to comment.