Skip to content

Instantly share code, notes, and snippets.

@kejadlen
kejadlen / setup.rb
Last active December 14, 2015 02:08
#!/usr/bin/env ruby
require 'thor'
class Setup < Thor
include Thor::Actions
CONF_DIR = File.expand_path('..', __FILE__)
def self.source_root; ''; end # WTF?
class Foo
end
module Bar
end
class Baz < Foo
include Bar
end
# encoding: utf-8
require 'letters'
class Foo
class Bar < self; end
def hello; puts 'world'; end
end
# So, this is not an uncommon occurence in our specs:
describe '...' do
describe '...' do
context '...' do
it '...' do
# Oh noes, our line is 80+ chars long!
expect { some_object.foo_bar_baz }.to raise_error(Foo::Bar::BazError)
end
end
build(-> { 'bar' })
def build(bar)
klass = Class.new
eigenklass = class << klass; self; end
eigenklass.send(:define_method, :bar, bar)
end

Title

Testing ** stuff

@kejadlen
kejadlen / test.md
Last active December 18, 2015 12:59
def foo
  puts 'hello'
end
def foo
  puts 'world'
end
class String
def dedent
gsub(/^#{self[/\A\s*/]}/, '')
end
end
require 'sinatra'
get '/foo/:id' do
p params[:id]
end
class Foo
attr_reader :input
def initialize(input)
@input = input
end
def bar
puts input
end