• This repository has been archived on 22/Aug/2019
  • Stars
    star
    436
  • Rank 99,877 (Top 2 %)
  • Language
    Ruby
  • Created about 13 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The universal Base class you've always wanted.

Base

DESCRIPTION:

People love Base classes! They have tons of methods waiting to be used. Just check out ActiveRecord::Base's method list:

>> ActiveRecord::Base.methods.length
=> 572

But why stop there? Why not have even more methods? In fact, let's put every method on one Base class!

So I did. It's called Base. Just subclass it and feel free to directly reference any class method, instance method, or constant defined on any module or class in the system. Like this:

class Cantaloupe < Base
  def embiggen
    encode64(deflate(SEPARATOR))
  end
end

>> Cantaloupe.new.embiggen
=> "eJzTBwAAMAAw\n"

See that embiggen method calling encode64 and deflate methods? Those come from the Base64 and Zlib modules. And the SEPARATOR constant is defined in File. Base don't care where it's defined! Base calls what it wants!

By the way, remember those 572 ActiveRecord methods? That's amateur stuff. Check out Base loaded inside a Rails app:

>> Base.new.methods.count
=> 5794

It's so badass that it takes five seconds just to answer that question!

Base is just craaazzy! It's the most fearless class in all of Ruby. Base doesn't afraid of anything!

LICENSE:

Distributed under the union of the terms specified by all current OSI-approved licenses. In the event of a conflict, a die is to be rolled.

PRAISE FOR BASE

@garybernhardt @kantrn ... Can't tell if joke or just Ruby.

- @shazow

@garybernhardt y u troll soooo good? ;-)

- @amerine

@garybernhardt Imagine all the things you could have done doing not that

- @mrb_bk

@garybernhardt I hate you.

- @jmazzi

SHOULD I USE THIS IN MY SYSTEM?

Yes. I am being completely serious. You should.

Definitely.

More Repositories

1

dotfiles

~grb. Things in here are often interdependent. A lot of stuff relies on scripts in bin/.
Vim Script
1,901
star
2

selecta

A fuzzy text selector for files and anything else you need to select. Use it from vim, from the command line, or anywhere you can run a shell command.
Ruby
1,345
star
3

raptor

An experimental web framework.
Ruby
367
star
4

readygo

A Ruby benchmarking tool accurate to sub-nanosecond time scales
Ruby
222
star
5

static-path

TypeScript
206
star
6

destroy-all-software-extras

Extra material for Destroy All Software Screencasts
Ruby
202
star
7

serveit

ServeIt, a synchronous server and rebuilder of static content like blogs, books, READMEs, etc.
Ruby
156
star
8

expecter

Expecter Gadget: better expectations (assertions) for Python.
Python
103
star
9

dingus

A record-then-assert test double library.
Python
98
star
10

do_not_want

(UNMAINTAINED) Do Not Want: Stops ActiveRecord from doing things you probably didn't want
Ruby
83
star
11

sucks-rocks

Does it suck? Or does it rock?
Ruby
58
star
12

pycomplexity

Scripts to show cyclomatic complexity of Python code in Vim and Emacs.
Python
46
star
13

cls

Cls: terse syntax for your classes
Ruby
40
star
14

python-mock-comparison

A comparison of Python's mocking and other test double libraries
Python
27
star
15

rubies

Ruby
24
star
16

blocks

Python
16
star
17

mote

A very experimental spec runner for Python. Beware: it is incomplete and may change drastically.
Python
12
star
18

LuaSpec

An executable Lua specification so I remember what I've learned.
Lua
12
star
19

explicit_import

Explicit imports for Ruby on a per-class/module basis
Ruby
9
star
20

prest

A REST client library for Python extracted sloppily from BitBacker
Python
5
star
21

the-march-of-progress

Find all the progress indicators from running applications. This does not solve an actual problem.
Ruby
3
star