Coder Social home page Coder Social logo

base's Introduction

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
=> 530

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 530 ActiveRecord methods? That's amateur stuff. Check out Base loaded inside a Rails app:

>> Base.new.methods.count
=> 6947

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!

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.

base's People

Contributors

dkubb avatar garybernhardt avatar jwilkins avatar stevenharman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.