README.md in active_adapter-0.1.0.pre vs README.md in active_adapter-0.1.0

- old
+ new

@@ -1,11 +1,9 @@ # ActiveAdapter -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/active_adapter`. To experiment with that code, run `bin/console` for an interactive prompt. +Simple implementation of the adapter pattern. -TODO: Delete this and the text above, and describe your gem - ## Installation Add this line to your application's Gemfile: ```ruby @@ -20,10 +18,42 @@ $ gem install active_adapter ## Usage -TODO: Write usage instructions here +Define your adaptable classes: + +```ruby +# vehicle.rb +class Vehicle < ActiveAdapter::Engine; end +``` + +```ruby +# vehicle_adapters/abstract.rb +class VehicleAdapters::Abstract < ActiveAdapter::Abstract + def run + adapter.run + end +end +``` + +```ruby +# vehicle_adapters/car.rb +class VehicleAdapters::Car < ActiveAdapter::Implement + def run + "Car running..." + end +end +``` + +Now you can use the adapter pattern as simple as you see: + +```ruby +vehicle = Vehicle.adapt(:car) +vehicle.run # => "Car running..." +``` + +See complete abilities of ActiveAdapter, please follow [Spec files](https://github.com/pinewong/active_adapter/blob/master/spec/active_adapter_spec.rb) ## Development After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.