There are no reviews yet. Be the first to send feedback to the community and the maintainers!
NAME map.rb SYNOPSIS the awesome ruby container you've always wanted: a string/symbol indifferent ordered hash that works in all rubies maps are bitchin ordered hashes that are both ordered, string/symbol indifferent, and have all sorts of sweetness like recursive conversion, more robust implementation than HashWithIndifferentAccess, support for struct like (map.foo) access, and support for option/keyword access which avoids several nasty classes of errors in many ruby libraries INSTALL gem install map URI http://github.com/ahoward/map DESCRIPTION # maps are always ordered. constructing them in an ordered fashion builds # them that way, although the normal hash contructor is also supported # m = Map[:k, :v, :key, :val] m = Map(:k, :v, :key, :val) m = Map.new(:k, :v, :key, :val) m = Map[[:k, :v], [:key, :val]] m = Map(:k => :v, :key => :val) # ruh-oh, the input hash loses order! m = Map.new(:k => :v, :key => :val) # ruh-oh, the input hash loses order! m = Map.new m[:a] = 0 m[:b] = 1 m[:c] = 2 p m.keys #=> ['a','b','c'] ### always ordered! p m.values #=> [0,1,2] ### always ordered! # maps don't care about symbol vs.string keys # p m[:a] #=> 0 p m["a"] #=> 0 # even via deep nesting # p m[:foo]['bar'][:baz] #=> 42 # many functions operate in a way one would expect from an ordered container # m.update(:k2 => :v2) m.update(:k2, :v2) key_val_pair = m.shift key_val_pair = m.pop # maps keep mapiness for even deep operations # m.update :nested => {:hashes => {:are => :converted}} # maps can give back clever little struct objects # m = Map(:foo => {:bar => 42}) s = m.struct p s.foo.bar #=> 42 # because option parsing is such a common use case for needing string/symbol # indifference map.rb comes out of the box loaded with option support # def foo(*args, &block) opts = Map.options(args) a = opts.getopt(:a) b = opts.getopt(:b, :default => false) end opts = Map.options(:a => 42, :b => nil, :c => false) opts.getopt(:a) #=> 42 opts.getopt(:b) #=> nil opts.getopt(:b, :default => 42) #=> 42 opts.getopt(:c) #=> false opts.getopt(:d, :default => false) #=> false # this avoids such bugs as # options = {:read_only => false} read_only = options[:read_only] || true # should be false but is true # with options this becomes # options = Map.options(:read_only => true) read_only = options.getopt(:read_only, :default => false) #=> true # maps support some really nice operators that hashes/orderedhashes do not # m = Map.new m.set(:h, :a, 0, 42) m.has?(:h, :a) #=> true p m #=> {'h' => {'a' => [42]}} m.set(:h, :a, 1, 42.0) p m #=> {'h' => {'a' => [42, 42.0]}} m.get(:h, :a, 1) #=> 42.0 m.get(:x, :y, :z) #=> nil m[:x][:y][:z] #=> raises exception! m = Map.new(:array => [0,1]) defaults = {:array => [nil, nil, 2]} m.apply(defaults) p m[:array] #=> [0,1,2] # they also support some different iteration styles # m = Map.new m.set( [:a, :b, :c, 0] => 0, [:a, :b, :c, 1] => 10, [:a, :b, :c, 2] => 20, [:a, :b, :c, 3] => 30 ) m.set(:x, :y, 42) m.set(:x, :z, 42.0) m.depth_first_each do |key, val| p key => val end #=> [:a, :b, :c, 0] => 0 #=> [:a, :b, :c, 1] => 10 #=> [:a, :b, :c, 2] => 20 #=> [:a, :b, :c, 3] => 30 #=> [:x, :y] => 42 #=> [:x, :z] => 42.0 USAGE see lib/map.rb and test/map_test.rb HISTORY 4.3.0: - support for dot keys. map.set('a.b.c' => 42) #=> {'a'=>{'b'=>{'c'=>42}}}
sekrets
sekrets is a command line tool and library used to securely manage encrypted files and settings in your rails' applications and git repositories.main
a class factory and dsl for generating command line programs real quickopen4
open child process with handles on pid, stdin, stdout, and stderr: manage child processes and their io handles easily.systemu
univeral capture of stdout and stderr and handling of child process pid for windows, *nix, etc.testy
a BDD testing framework for ruby that's mad at the world and plans to kick it's ass in 78 freakin lines of codeconfiguration
pure ruby scoped configuration files.forkoff
brain-dead simple parallel processing for rubyfattr
fattr.rb is a "fatter attr" for ruby and borrows heavily from the metakoans.rb ruby quizsession
session offers a persistent way to drive the shell (/bin/sh) via rubydao
sa-weet data access object library for rails. top secret.lockfile
a ruby library for creating NFS safe lockfilesmacaddr
cross platform mac address determination for rubymiddleman-gibberish
password protect middleman pages - even on s3threadify
threadify.rb makes it stupid easy to process a bunch of data using 'n' worker threadsshared
shared.rb provides a super easy way to share code between classes or modules in a simple way.bj
Backgroundjob (Bj) is a brain dead simple, zero admin, background priority queue for Rails.tagz
tagz.rb generates html, xml, or any sgml variant like a small ninja running across the backs of a herd of giraffes swatting of heads like a mark-up weedwacker.demon
demon.rb - the ruby daemon library you've been waiting forslave
easy management of child process works over pipes and drbrails_build
A very small, very simple, very fast, and bullet proof static site generator built as a Rails 5 engine.objectpool
a simple, robust, generic thread-safe object pool for rubyrq
ruby queue is a zero-admin zero-configuration tool used to create instant unix clustersraptcha
low drain bamage, storage-less, session-less, plugin-less, zero admin, single-source-file secure captcha system for ruby and/or rails.arrayfields
allow keyword access to array instances.tumblr
a command line utility and library for the excellent tumblr blogging platformhelene
helene is a plugin for writing rails applications on top of amazon's aws platform including sdb, s3, and sqsrego
run arbitrary commands easily when files changefbomb
fbomb is the dangerous flowdock botfucking_favicons
fucking favicons fucking suckmongoid-haystack
a mongoid 3 zero-config, zero-integration, POLS pure mongo fulltext solutioncoxswain
encapsulate pre-forking master / worker pattern for rubyjquery.bires
bandwidth limited progressive image enhancementhashish
awesome data access layer for rails/ruby projectsrails_current
track current_STUFF mo bettaassassin
no zombies ever, not even on `exit!` or `kill -9`default_url_options
all relative urls in rails all the time. even in mailers.forkhandle
a teeny library / design pattern for managing connections in a process and thread safe fashionrememberthemilk
simple (162 loc), json only, interface to the excellent RememberTheMilk APIwrap
non-sucky :before and :after callbacks for any ruby classconducer
a model+view component for rails that combines the conductor and presenter patternro
ro is library for managing your site's content in git, as god intended.rails_default_url_options
you really can have default_url_options everywhere. even in mailers.options
options.rb handles keyword options in ruby in a simple and robust wayirbcp
irbcp gives access to your system's clipboard (copy and paste) from irbrails_errors2html
simple and sane active_model error html renderingfukung
perhaps the most important ruby code EVAAARRR! gets random images from http://fukung.net.rails_nav
objectified navigation for railscssjs
a zero learning curve zero contraints dsl for writing css stylesheets in javascriptpork
pork supports parallel programming in ruby using forked actors and durable sqlite message queuesisolation
a small rails app to demonstrate what *you* don't understand about RDBMS transactionsmongoid-fts
enable mongodb's new fulltext simply and quickly on your mongoid models, including pagination.lru_cache
a simple but efficient implementation of a size limited least recently used cache in rubyterminator
an external timeout mechanism based on processes and signalscdc
uber simple cross domain communication for javascript/iframescoerce
a ruby library full of common cast/coercion operationsrails_view
render views from anywhere. even without a controller contextrails_helper
helper = Helper.new and helper.link_to(:foo)ggeocode
simple wrapper on google's new geocoding apisuck
gem to show issues with gem/minigem load orderingalpo
a library and design pattern for building sane web applications on top of the rails' stackbackup.rake
rails' rake task for backup up and loading data+assets as yaml+filesid3rename
id3rename is a program to do simple renaming of mp3 filesnfsutils
Ruby FileUtils for NFSbookify
development moved to https://github.com/everlater/bookifysenv
the 12-factor environment tool your mother told you to usecodeforpeople
billions and billions of libsledis
a K.I.S.S auto-rotating redis logger for ruby/railskgb
ultra lightweight javascript decision tree builderimage_cache
a small utility library to facility caching image uploads between form validation failures.gnip-ruby
Ruby library for utilizing Gnip services.linked_list
a simple linked list implementation for rubybucket
bucket is a command-line interface for amazon's s3 servicetmpdir_block
extends ruby's built-in Dir.tmpdir to accept a block.bestofyoutube
simple ruby library to grab some good video urls from http://bestofyoutube.comsuperhash
A general mechanism for defining attribute inheritance structures among objects of any type, not just classestesting.rb
adds the minimal features required in order to make test/unit not suckopenobject
a simple property based container that's much more capable than a blankslate but far less polluted than ruby's built-in OpenStructcandy_store
hybrid session store that combines rails' built-in cookie based session store with its database backed oneslug
a simple slug library. unicode prepared.markdown
my markdown scriptmongoid-bolt
mongoid-bolt is a concrete lock implementation and mixin.growltdf
growltdf is the greatest program evar. it let's you scrape http://cyclingnews.com for TDF updates and dump them into growl to you can keep up with the race while working.nmap
narray + mmap = wicked fast persistent numerical arrays for rubymob
background jobs for mongoidfoobar
ydb
mo-betta the yaml/store.hrs
tracking teh hours from the climp3scrape
download shit-loads of mp3s from web pageswapp
golden.imageupload_cache
a small utility library to facility caching http file uploads between form validation failures. designed for rails, but usable anywhere.forkify
forkify.rb makes it easy to process a bunch of data using 'n' worker processesansible
magic unicorns for your deployzcampfire
a command line script for using 37signal's campfire chat roomcast
a collection of casting methods for rubyfifo
a very simple javascript fifo queue / cacheey-cloud-recipes
A starter repo for custom chef recipes on EY's cloud platformtest
one-click-hugo-cms
attributes
the implementation of attributes.rb borrows many of the best ideas from the metakoans.rb ruby quiz (ps. fattr >= attributes)gnip-expander
relay a gnip publisher stream to another, expanding shortened uris in the processLove Open Source and this site? Check out how you can help us