Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
attr_chain for chainable, single method attribute (get|setters)
Ruby
tag: v0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.document
.gitignore
LICENSE
README.md
Rakefile
VERSION.yml
attr_chain.gemspec

README.md

attr_chain

attr_chain is for when you're building up a DSL in which you'd like to have attributes that can be chained together when they're being set.

Its simple and small, you probably aren't interested, I kept on using this pattern and wanted to abstract it away from my other code.


Working example

require 'attr_chain'
class Chainsaw
  include AttributeChain
  attr_chain :start, :cut
end

>> c = Chainsaw.new

>> c.start 
=> nil

>> c.start(:now).cut(:hippy)
>> c.start 
=> :now

>> c.cut
=> :hippy

Copyright

Copyright (c) 2009 Ben Schwarz. See LICENSE for details.

Something went wrong with that request. Please try again.