repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
dobtco/filterer | https://github.com/dobtco/filterer/blob/47b16e84651da4769d2932076c087d88fd9de167/lib/generators/filterer/templates/filter.rb | lib/generators/filterer/templates/filter.rb | class <%= class_name %> < Filterer::Base
end
| ruby | MIT | 47b16e84651da4769d2932076c087d88fd9de167 | 2026-01-04T17:58:11.153161Z | false |
dobtco/filterer | https://github.com/dobtco/filterer/blob/47b16e84651da4769d2932076c087d88fd9de167/lib/filterer/active_record.rb | lib/filterer/active_record.rb | module Filterer
module ActiveRecord
extend ActiveSupport::Concern
class_methods do
def filter(params = {}, opts = {})
delegate_to_filterer(:filter, params, opts)
end
def chain(params = {}, opts = {})
delegate_to_filterer(:chain, params, opts)
end
private
... | ruby | MIT | 47b16e84651da4769d2932076c087d88fd9de167 | 2026-01-04T17:58:11.153161Z | false |
dobtco/filterer | https://github.com/dobtco/filterer/blob/47b16e84651da4769d2932076c087d88fd9de167/lib/filterer/version.rb | lib/filterer/version.rb | module Filterer
VERSION = '2.0.0'
end
| ruby | MIT | 47b16e84651da4769d2932076c087d88fd9de167 | 2026-01-04T17:58:11.153161Z | false |
dobtco/filterer | https://github.com/dobtco/filterer/blob/47b16e84651da4769d2932076c087d88fd9de167/lib/filterer/base.rb | lib/filterer/base.rb | module Filterer
class Base
attr_accessor :results,
:meta,
:sort,
:params,
:opts
class_attribute :sort_options
self.sort_options = []
class_attribute :per_page
self.per_page = 20
class_attribute :allow_per_page_override
... | ruby | MIT | 47b16e84651da4769d2932076c087d88fd9de167 | 2026-01-04T17:58:11.153161Z | false |
dobtco/filterer | https://github.com/dobtco/filterer/blob/47b16e84651da4769d2932076c087d88fd9de167/lib/filterer/engine.rb | lib/filterer/engine.rb | module Filterer
class Engine < ::Rails::Engine
isolate_namespace Filterer
ActiveSupport.on_load(:active_record) do
require 'filterer/active_record'
end
end
end
| ruby | MIT | 47b16e84651da4769d2932076c087d88fd9de167 | 2026-01-04T17:58:11.153161Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/res/scaffold/simple/main.rb | res/scaffold/simple/main.rb | require 'goby'
include Goby
require_relative 'map/farm.rb'
# Set this to true in order to use BGM.
Music::set_playback(false)
# By default, we've included no music files.
# The Music module also includes a function
# to change the music-playing program.
# Clear the terminal.
system("clear")
# Allow the player to ... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/res/scaffold/simple/farm.rb | res/scaffold/simple/farm.rb | # This is an example of how to create a Map. You can
# define the name, where to respawn, and the 2D display of
# the Map - each point is referred to as a Tile.
class Farm < Map
def initialize
super(name: "Farm")
# Define the main tiles on this map.
grass = Tile.new(description: "You are standing on some... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/spec_helper.rb | spec/spec_helper.rb | # This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# file... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/music_spec.rb | spec/goby/music_spec.rb | require 'goby'
RSpec.describe Music do
include Music
before(:all) do
_relativePATH = File.expand_path File.dirname(__FILE__)
@music = _relativePATH + "/bach.mid"
end
# If you do not have BGM support and would like to run the
# test suite locally, replace 'it' with 'xit'.
it "should play and stop t... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/world_command_spec.rb | spec/goby/world_command_spec.rb | require 'goby'
RSpec.describe do
include WorldCommand
let!(:map) { Map.new(tiles: [ [ Tile.new,
Tile.new(events: [NPC.new]),
Tile.new(events: [Event.new(visible: false)]) ],
[ Tile.new(events: [Shop.new, NPC.new]),
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/driver_spec.rb | spec/goby/driver_spec.rb | require 'goby'
RSpec.describe do
let(:player) { Player.new }
# Success for each of these tests mean
# that run_driver exits without error.
context "run driver" do
it "should exit on 'quit'" do
__stdin("quit\n") { run_driver(player) }
end
it "should accept various commands in a looping fash... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/extension_spec.rb | spec/goby/extension_spec.rb | require 'goby'
RSpec.describe Array do
context "nonempty?" do
it "returns true when the array contains elements" do
expect([1].nonempty?).to be true
expect(["Hello"].nonempty?).to be true
expect([false, false].nonempty?).to be true
end
it "returns false when the array contains no eleme... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/scaffold_spec.rb | spec/goby/scaffold_spec.rb | require 'goby'
require 'fileutils'
RSpec.describe Scaffold do
context "simple" do
it "should create the appropriate directories & files" do
project = "goby-project"
Scaffold::simple project
# Ensure all of the directories exist.
expect(Dir.exists? "#{project}").to be true
[ '', '... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/util_spec.rb | spec/goby/util_spec.rb | require 'goby'
RSpec.describe do
context "couple" do
it "should correctly initialize the couple" do
couple = C["Apple", 1]
expect(couple.first).to eq "Apple"
expect(couple.second).to eq 1
end
it "should equate two objects based on both 'first' and 'second'" do
couple1 = C["Apple"... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/entity/player_spec.rb | spec/goby/entity/player_spec.rb | require 'goby'
RSpec.describe Player do
# Constructs a map in the shape of a plus sign.
let!(:map) { Map.new(tiles: [[Tile.new(passable: false), Tile.new, Tile.new(passable: false)],
[Tile.new, Tile.new, Tile.new(monsters: [Monster.new(battle_commands: [Attack.new(success_rate: 0)])... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/entity/fighter_spec.rb | spec/goby/entity/fighter_spec.rb | require 'goby'
RSpec.describe Fighter do
let!(:empty_fighter) { Class.new { extend Fighter } }
let(:fighter_class) {
Class.new(Entity) do
include Fighter
def initialize(name: "Fighter", stats: {}, inventory: [], gold: 0, battle_commands: [], outfit: {})
super(name: name, stats: stats, inve... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/entity/monster_spec.rb | spec/goby/entity/monster_spec.rb | require 'goby'
RSpec.describe Monster do
let(:slime_item) { Item.new }
let(:wolf) {
Monster.new(name: "Wolf",
stats: { max_hp: 20,
hp: 15,
attack: 2,
defense: 2,
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/entity/entity_spec.rb | spec/goby/entity/entity_spec.rb | require 'goby'
RSpec.describe Entity do
let(:entity) { Entity.new }
context "constructor" do
it "has the correct default parameters" do
expect(entity.name).to eq "Entity"
stats = entity.stats
expect(stats[:max_hp]).to eq 1
expect(stats[:hp]).to eq 1
expect(stats[:attack]). to eq ... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/event/chest_spec.rb | spec/goby/event/chest_spec.rb | require 'goby'
RSpec.describe Chest do
let!(:player) { Player.new }
let!(:chest) { Chest.new }
let!(:gold_chest) { Chest.new(gold: 100) }
let!(:treasure_chest) { Chest.new(treasures: [Item.new, Food.new, Helmet.new]) }
let!(:giant_chest) { Chest.new(gold: 100, treasures: [Item.new, Food.new, Helmet.new]) }
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/event/shop_spec.rb | spec/goby/event/shop_spec.rb | require 'goby'
RSpec.describe Shop do
let!(:shop) { Shop.new }
let!(:tools) { [Item.new(name: "Basket", price: 5),
Item.new(name: "Knife", price: 10),
Item.new(name: "Fork", price: 12),
Item.new(name: "Screwdriver", price: 7)] }
let!(:tool_shop) { Shop.new(name... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/event/npc_spec.rb | spec/goby/event/npc_spec.rb | require 'goby'
RSpec.describe NPC do
let(:npc) { NPC.new }
let(:entity) { Entity.new }
context "constructor" do
it "has the correct default parameters" do
expect(npc.name).to eq "NPC"
expect(npc.command).to eq "talk"
expect(npc.mode).to eq 0
expect(npc.visible).to eq true
end
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/event/event_spec.rb | spec/goby/event/event_spec.rb | require 'goby'
RSpec.describe Event do
let(:event) { Event.new }
let(:entity) { Entity.new }
context "constructor" do
it "has the correct default parameters" do
expect(event.command).to eq "event"
expect(event.mode).to eq 0
expect(event.visible).to eq true
end
it "correctly assi... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/battle/battle_spec.rb | spec/goby/battle/battle_spec.rb | require 'goby'
RSpec.describe Goby::Battle do
let(:dummy_fighter_class) {
Class.new(Entity) do
include Fighter
def initialize(name: "Player", stats: {}, inventory: [], gold: 0, battle_commands: [], outfit: {})
super(name: name, stats: stats, inventory: inventory, gold: gold, outfit: outfit)... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/battle/escape_spec.rb | spec/goby/battle/escape_spec.rb | require 'goby'
RSpec.describe Goby::Escape do
let(:player) { Player.new }
let(:monster) { Monster.new }
let(:escape) { Escape.new }
context "constructor" do
it "has an appropriate default name" do
expect(escape.name).to eq "Escape"
end
end
context "run" do
# The purpose of this test is... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/battle/use_spec.rb | spec/goby/battle/use_spec.rb | require 'goby'
RSpec.describe Use do
let(:use) { Use.new }
context "constructor" do
it "has an appropriate default name" do
expect(use.name).to eq "Use"
end
end
context "run" do
let(:player) { Player.new(stats: { max_hp: 10, hp: 3 },
battle_commands: [@use],
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/battle/battle_command_spec.rb | spec/goby/battle/battle_command_spec.rb | require 'goby'
RSpec.describe Goby::BattleCommand do
let(:cmd) { BattleCommand.new }
context "constructor" do
it "has the correct default parameters" do
expect(cmd.name).to eq "BattleCommand"
end
it "correctly assigns custom parameters" do
dance = BattleCommand.new(name: "Dance")
e... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/battle/attack_spec.rb | spec/goby/battle/attack_spec.rb | require 'goby'
RSpec.describe Goby::Attack do
let!(:user) { Player.new(stats: { max_hp: 50, attack: 6, defense: 4 }) }
let!(:enemy) { Monster.new(stats: { max_hp: 30, attack: 3, defense: 2 }) }
let(:attack) { Attack.new(strength: 5) }
let(:cry) { Attack.new(name: "Cry", success_rate: 0) }
context "construc... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/item/weapon_spec.rb | spec/goby/item/weapon_spec.rb | require 'goby'
RSpec.describe Weapon do
let(:weapon) { Weapon.new }
let(:entity) { Entity.new.extend(Fighter) }
let(:dummy_fighter_class) { Class.new(Entity) {include Fighter} }
context "constructor" do
it "has the correct default parameters" do
expect(weapon.name).to eq "Weapon"
expect(weapo... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/item/helmet_spec.rb | spec/goby/item/helmet_spec.rb | require 'goby'
RSpec.describe Helmet do
context "constructor" do
it "has the correct default parameters" do
helmet = Helmet.new
expect(helmet.name).to eq "Helmet"
expect(helmet.price).to eq 0
expect(helmet.consumable).to eq false
expect(helmet.disposable).to eq true
expect(he... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/item/food_spec.rb | spec/goby/item/food_spec.rb | require 'goby'
RSpec.describe Food do
let(:food) { Food.new }
let(:magic_banana) { Food.new(name: "Magic Banana", price: 5,
consumable: false, disposable: false,
recovers: 10) }
context "constructor" do
it "has the correct default parameters" do
e... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/item/equippable_spec.rb | spec/goby/item/equippable_spec.rb | require 'goby'
RSpec.describe Equippable do
let(:equippable) { Class.new { extend Equippable } }
let(:entity) { Entity.new }
context "placeholder methods" do
it "forces :stat_change to be implemented" do
expect { equippable.stat_change }.to raise_error(NotImplementedError, 'An Equippable Item must im... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/item/torso_spec.rb | spec/goby/item/torso_spec.rb | require 'goby'
RSpec.describe Torso do
context "constructor" do
it "has the correct default parameters" do
torso = Torso.new
expect(torso.name).to eq "Torso"
expect(torso.price).to eq 0
expect(torso.consumable).to eq false
expect(torso.disposable).to eq true
expect(torso.type... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/item/item_spec.rb | spec/goby/item/item_spec.rb | require 'goby'
RSpec.describe Item do
let(:item) { Item.new }
context "constructor" do
it "has the correct default parameters" do
expect(item.name).to eq "Item"
expect(item.price).to eq 0
expect(item.consumable).to eq true
expect(item.disposable).to eq true
end
it "correctly a... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/item/shield_spec.rb | spec/goby/item/shield_spec.rb | require 'goby'
RSpec.describe Shield do
context "constructor" do
it "has the correct default parameters" do
shield = Shield.new
expect(shield.name).to eq "Shield"
expect(shield.price).to eq 0
expect(shield.consumable).to eq false
expect(shield.disposable).to eq true
expect(sh... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/item/legs_spec.rb | spec/goby/item/legs_spec.rb | require 'goby'
RSpec.describe Legs do
context "constructor" do
it "has the correct default parameters" do
legs = Legs.new
expect(legs.name).to eq "Legs"
expect(legs.price).to eq 0
expect(legs.consumable).to eq false
expect(legs.disposable).to eq true
expect(legs.type).to eq :... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/map/tile_spec.rb | spec/goby/map/tile_spec.rb | require 'goby'
RSpec.describe Tile do
context "constructor" do
it "has the correct default parameters" do
tile = Tile.new
expect(tile.passable).to eq true
expect(tile.seen).to eq false
expect(tile.description).to eq ""
expect(tile.events).to eq []
expect(tile.monsters).to eq ... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/spec/goby/map/map_spec.rb | spec/goby/map/map_spec.rb | require 'goby'
RSpec.describe Map do
let(:lake) { Map.new(name: "Lake",
tiles: [ [ Tile.new, Tile.new(passable: false) ] ] ) }
context "constructor" do
it "has the correct default parameters" do
map = Map.new
expect(map.name).to eq "Map"
expect(map.tiles[0][0].passable).... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby.rb | lib/goby.rb | # Import order matters.
require 'goby/scaffold'
require 'goby/extension'
require 'goby/util'
require 'goby/world_command'
require 'goby/music'
require 'goby/driver'
require 'goby/battle/battle'
require 'goby/battle/battle_command'
require 'goby/battle/attack'
require 'goby/battle/escape'
require 'goby/battle/use'
re... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/scaffold.rb | lib/goby/scaffold.rb | module Goby
# Functions for scaffolding starter projects.
module Scaffold
# Simple starter project w/o testing.
#
# @param [String] project the project name.
def self.simple(project)
# TODO: detect existence of project folder.
# Make the directory structure.
Dir.mkdir project
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/driver.rb | lib/goby/driver.rb | require 'goby'
module Goby
include Music
include WorldCommand
# Runs the main game loop.
#
# @param [Player] player the player of the game.
def run_driver(player)
while (run_turn(player)); end
stop_music
end
private
# Clear the terminal and display the minimap.
#
# @param [Playe... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/world_command.rb | lib/goby/world_command.rb | module Goby
# Functions that handle commands on the "world map."
module WorldCommand
# String literal providing default commands.
DEFAULT_COMMANDS =
%{ Command Purpose
w (↑)
a (←) s (↓) d (→) Movement
help Show the help menu
map Print the map
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/music.rb | lib/goby/music.rb | module Goby
# Methods for playing/stopping background music (BGM).
module Music
# Specify the program that should play the music.
# Without overwriting, it is set to a default (see @@program).
#
# @param [String] name the name of the music-playing program.
def set_program(name)
@@program... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/extension.rb | lib/goby/extension.rb | require 'set'
# Provides additional methods for Array.
class Array
# Returns true iff the array is not empty.
def nonempty?
return !empty?
end
end
# Provides additional methods for Integer.
class Integer
# Returns true if the integer is a positive number.
def positive?
return self > 0
end
# Re... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/util.rb | lib/goby/util.rb | require 'readline'
require 'yaml'
# Collection of classes, modules, and functions that make
# up the Goby framework.
module Goby
# Stores a pair of values as a couple.
class C
# Syntactic sugar to create a couple using C[a, b]
#
# @param [Object] first the first object in the pair.
# @param [Obje... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/entity/monster.rb | lib/goby/entity/monster.rb | require 'goby'
module Goby
# An Entity controlled by the CPU. Used for battle against Players.
class Monster < Entity
include Fighter
# @param [String] name the name.
# @param [Hash] stats hash of stats
# @param [[C(Item, Integer)]] inventory an array of pairs of items and their respective amoun... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/entity/fighter.rb | lib/goby/entity/fighter.rb | require 'goby'
module Goby
# Methods and variables for something that can battle with another Fighter.
module Fighter
# Exception thrown when a non-Fighter tries to enter battle.
class UnfightableException < Exception
end
# The function that handles how an Fighter behaves after losing a battle.
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/entity/entity.rb | lib/goby/entity/entity.rb | require 'goby'
module Goby
# Provides the ability to fight, equip/unequip weapons & armor,
# and carry items & gold.
class Entity
# Error when the entity specifies a non-existent item.
NO_SUCH_ITEM_ERROR = "What?! You don't have THAT!\n\n"
# Error when the entity specifies an item not equipped.
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/entity/player.rb | lib/goby/entity/player.rb | require 'goby'
module Goby
# Extends upon Entity by providing a location in the
# form of a Map and a pair of y-x location. Overrides
# some methods to accept input during battle.
class Player < Entity
include WorldCommand
include Fighter
# Default map when no "good" map & location specified.
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/event/event.rb | lib/goby/event/event.rb | module Goby
# A Player can interact with these on the Map.
class Event
# The default text for when the event doesn't do anything.
DEFAULT_RUN_TEXT = "Nothing happens.\n\n"
# @param [String] command the command to activate the event.
# @param [Integer] mode convenient way for an event to have mult... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/event/npc.rb | lib/goby/event/npc.rb | require 'goby'
module Goby
# A non-player character with whom the player can interact.
# Always activated with the 'talk' command.
class NPC < Event
# @param [String] name the name.
# @param [Integer] mode convenient way for a NPC to have multiple actions.
# @param [Boolean] visible whether the NPC... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/event/chest.rb | lib/goby/event/chest.rb | require 'goby'
module Goby
# A chest containing gold and/or items.
class Chest < Event
# @param [Integer] mode convenient way for a chest to have multiple actions.
# @param [Boolean] visible whether the chest can be seen/activated.
# @param [Integer] gold the amount of gold in this chest.
# @para... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/event/shop.rb | lib/goby/event/shop.rb | require 'goby'
module Goby
# Allows a player to buy and sell Items.
class Shop < Event
# Message for when the shop has nothing to sell.
NO_ITEMS_MESSAGE = "Sorry, we're out of stock right now!\n\n"
# Message for when the player has nothing to sell.
NOTHING_TO_SELL = "You have nothing to sell!\n\n... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/battle/battle_command.rb | lib/goby/battle/battle_command.rb | module Goby
# Commands that are used in the battle system. At each turn,
# an Entity specifies which BattleCommand to use.
class BattleCommand
# Text for when the battle command does nothing.
NO_ACTION = "Nothing happens.\n\n"
# @param [String] name the name.
def initialize(name: "BattleCommand... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/battle/escape.rb | lib/goby/battle/escape.rb | require 'goby'
module Goby
# Allows an Entity to try to escape from the opponent.
class Escape < BattleCommand
# Text for successful escape.
SUCCESS = "Successful escape!\n\n"
# Text for failed escape.
FAILURE = "Unable to escape!\n\n"
# Initializes the Escape command.
def initialize
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/battle/use.rb | lib/goby/battle/use.rb | require 'goby'
module Goby
# Allows an Entity to use an Item in battle.
class Use < BattleCommand
# Initializes the Use command.
def initialize
super(name: "Use")
end
# Returns true iff the user's inventory is empty.
#
# @param [Entity] user the one who is using the command.
# ... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/battle/attack.rb | lib/goby/battle/attack.rb | require 'goby'
module Goby
# Simple physical attack.
class Attack < BattleCommand
# @param [String] name the name.
# @param [Integer] strength the strength.
# @param [Integer] success_rate the chance of success.
def initialize(name: "Attack", strength: 1, success_rate: 100)
super(name: name... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/battle/battle.rb | lib/goby/battle/battle.rb | require 'goby'
module Goby
# Representation of a fight between two Fighters.
class Battle
# @param [Entity] entity_a the first entity in the battle
# @param [Entity] entity_b the second entity in the battle
def initialize(entity_a, entity_b)
@entity_a = entity_a
@entity_b = entity_b
e... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/item/food.rb | lib/goby/item/food.rb | require 'goby'
module Goby
# Recovers HP when used.
class Food < Item
# @param [String] name the name.
# @param [Integer] price the cost in a shop.
# @param [Boolean] consumable upon use, the item is lost when true.
# @param [Boolean] disposable allowed to sell or drop item when true.
# @para... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/item/weapon.rb | lib/goby/item/weapon.rb | require 'goby'
module Goby
# Can be worn in the Player's outfit.
class Weapon < Item
include Equippable
# @param [String] name the name.
# @param [Integer] price the cost in a shop.
# @param [Boolean] consumable determines whether the item is lost when used.
# @param [Boolean] disposable allo... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/item/legs.rb | lib/goby/item/legs.rb | require 'goby'
module Goby
# Can be worn in the Player's outfit.
class Legs < Item
include Equippable
# @param [String] name the name.
# @param [Integer] price the cost in a shop.
# @param [Boolean] consumable upon use, the item is lost when true.
# @param [Boolean] disposable allowed to sell or drop... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/item/shield.rb | lib/goby/item/shield.rb | require 'goby'
module Goby
# Can be worn in the Player's outfit.
class Shield < Item
include Equippable
# @param [String] name the name.
# @param [Integer] price the cost in a shop.
# @param [Boolean] consumable upon use, the item is lost when true.
# @param [Boolean] disposable allowed to sell or dr... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/item/equippable.rb | lib/goby/item/equippable.rb | module Goby
# Provides methods for equipping & unequipping an Item.
module Equippable
# The function that returns the type of the item.
# Subclasses must override this function.
#
def stat_change
raise(NotImplementedError, 'An Equippable Item must implement a stat_change Hash')
end
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/item/item.rb | lib/goby/item/item.rb | module Goby
# Can be used by an Entity in order to trigger anything specified.
# Placed into the Entity's inventory.
class Item
# Default text when the Item doesn't do anything.
DEFAULT_USE_TEXT = "Nothing happens.\n\n"
# @param [String] name the name.
# @param [Integer] price the cost in a sho... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/item/helmet.rb | lib/goby/item/helmet.rb | require 'goby'
module Goby
# Can be worn in the Player's outfit.
class Helmet < Item
include Equippable
# @param [String] name the name.
# @param [Integer] price the cost in a shop.
# @param [Boolean] consumable upon use, the item is lost when true.
# @param [Boolean] disposable allowed to sell or dr... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/item/torso.rb | lib/goby/item/torso.rb | require 'goby'
module Goby
# Can be worn in the Player's outfit.
class Torso < Item
include Equippable
# @param [String] name the name.
# @param [Integer] price the cost in a shop.
# @param [Boolean] consumable determines whether the item is lost when used.
# @param [Boolean] disposable allowed to se... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/map/map.rb | lib/goby/map/map.rb | module Goby
# A 2D arrangement of Tiles. The Player can move around on it.
class Map
# @param [String] name the name.
# @param [[Tile]] tiles the content of the map.
def initialize(name: "Map", tiles: [[Tile.new]], music: nil)
@name = name
@tiles = tiles
@music = music
end
#... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
nskins/goby | https://github.com/nskins/goby/blob/56c9ca5f825b50f9126d9e8759ba8666c72d73b5/lib/goby/map/tile.rb | lib/goby/map/tile.rb | module Goby
# Describes a single location on a Map. Can have Events and Monsters.
# Provides variables that control its graphical representation on the Map.
class Tile
# Default graphic for passable tiles.
DEFAULT_PASSABLE = "·"
# Default graphic for impassable tiles.
DEFAULT_IMPASSABLE = "■"
... | ruby | MIT | 56c9ca5f825b50f9126d9e8759ba8666c72d73b5 | 2026-01-04T17:58:11.621150Z | false |
github/rack-statsd | https://github.com/github/rack-statsd/blob/f03b18ef5c27df861384930c206d797be540e956/lib/rack-statsd.rb | lib/rack-statsd.rb | module RackStatsD
VERSION = "0.2.1"
# Simple middleware to add a quick status URL for tools like Nagios.
class RequestStatus
REQUEST_METHOD = 'REQUEST_METHOD'.freeze
GET = 'GET'.freeze
PATH_INFO = 'PATH_INFO'.freeze
STATUS_PATH = '/status'
HEADERS = {"Content-Type" =... | ruby | MIT | f03b18ef5c27df861384930c206d797be540e956 | 2026-01-04T17:58:14.947191Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/helpers/application_helper.rb | app/helpers/application_helper.rb | module ApplicationHelper
def sortable(column, title = nil)
title ||= column.titleize
css_class = (column == sort_column) ? "current #{sort_direction}" : nil
direction = (column == sort_column && sort_direction == "asc") ? "desc" : "asc"
link_to title, { :sort => column, :direction => direction }, { :... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/helpers/pages_helper.rb | app/helpers/pages_helper.rb | module PagesHelper
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/helpers/admin/users_helper.rb | app/helpers/admin/users_helper.rb | module Admin::UsersHelper
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/helpers/admin/base_helper.rb | app/helpers/admin/base_helper.rb | module Admin::BaseHelper
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/controllers/pages_controller.rb | app/controllers/pages_controller.rb | class PagesController < ApplicationController
def index
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/controllers/application_controller.rb | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
protect_from_forgery
def render404
render :file => File.join(Rails.root, 'public', '404.html'), :status => 404, :layout => false
return true
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/controllers/admin/users_controller.rb | app/controllers/admin/users_controller.rb | class Admin::UsersController < Admin::BaseController
helper_method :sort_column, :sort_direction, :search_params
before_filter :find_user, :only => [:edit, :update, :show, :destroy]
def index
@q = User.search(params[:q])
search_relation = @q.result
@users = search_relation.order(sort_column + " " +... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/controllers/admin/base_controller.rb | app/controllers/admin/base_controller.rb | class Admin::BaseController < ApplicationController
before_filter :require_admin
layout "admin"
def index
end
protected
def require_admin
unless current_user.try(:admin?)
render404 and return false
end
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/controllers/users/omniauth_callbacks_controller.rb | app/controllers/users/omniauth_callbacks_controller.rb | class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
@user = User.find_for_facebook_oauth(env["omniauth.auth"], current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook"
sign_in_and_redirect @user, :ev... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/models/role.rb | app/models/role.rb | class Role < ActiveRecord::Base
has_and_belongs_to_many :users
def self.admin
find_or_create_by(:name => "admin")
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/app/models/user.rb | app/models/user.rb | class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
devise :omniaut... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/db/seeds.rb | db/seeds.rb | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
# Mayor.create(:name =>... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/db/schema.rb | db/schema.rb | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/db/migrate/20110405113203_devise_create_users.rb | db/migrate/20110405113203_devise_create_users.rb | class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
t... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/db/migrate/20110415105605_create_roles.rb | db/migrate/20110415105605_create_roles.rb | class CreateRoles < ActiveRecord::Migration
def self.up
create_table :roles do |t|
t.string :name
t.timestamps
end
end
def self.down
drop_table :roles
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/db/migrate/20110415110329_user_has_and_belongs_to_many_roles.rb | db/migrate/20110415110329_user_has_and_belongs_to_many_roles.rb | class UserHasAndBelongsToManyRoles < ActiveRecord::Migration
def self.up
create_table :roles_users, :id => false do |t|
t.references :role, :user
end
end
def self.down
drop_table :roles_users
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/features/support/env.rb | features/support/env.rb | require 'rubygems'
require 'cucumber/rails'
require 'email_spec/cucumber'
World FactoryGirl::Syntax::Methods
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
# prefer to use XPath just remove this line and adj... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/features/support/paths.rb | features/support/paths.rb | module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in web_steps.rb
#
def path_to(page_name)
case page_name
when /the home\s?page/
'/'
# Add more mappings here.
# Here is an example that pulls values out of th... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/features/support/omniauth.rb | features/support/omniauth.rb | FACEBOOK_INFO = {
"id" => "12345",
"link" => "http://facebook.com/john_doe",
"email" => "user@example.com",
"first_name" => "John",
"last_name" => "Doe",
"website" => "http://www.example.com"
}
Before("@omniauth_test") do
OmniAuth.config.test_mode = true
# the symbol passed to mock_auth is the same as... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/features/support/selectors.rb | features/support/selectors.rb | module HtmlSelectorsHelpers
# Maps a name to a selector. Used primarily by the
#
# When /^(.+) within (.+)$/ do |step, scope|
#
# step definitions in web_steps.rb
#
def selector_for(locator)
case locator
when /the page/
"html > body"
# Add more mappings here.
# Here is an example... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/features/step_definitions/authentication_steps.rb | features/step_definitions/authentication_steps.rb | Given /^I am registered$/ do
@registered_user = create(:user, :email => "john@doe.com")
end
When(/^I sign up$/) do
click_link "Sign up"
fill_in "Email", :with => "john@doe.com"
fill_in "Password", :with => "password"
fill_in "Password confirmation", :with => "password"
click_button "Sign up"
end
Then(/^I ... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/features/step_definitions/homepage_steps.rb | features/step_definitions/homepage_steps.rb | Given(/^I am on the homepage$/) do
visit("/")
end
Then(/^I should see the welcome message$/) do
page.should have_content("Welcome")
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/features/step_definitions/admin_user_management_steps.rb | features/step_definitions/admin_user_management_steps.rb | Given /^I am admin$/ do
@registered_user.make_admin
end
Given /^I am logged in as admin$/ do
steps %Q{
Given I am registered
And I am admin
And I am on the homepage
When I sign in
}
end
Given /^a user with email "([^"]*)" exists$/ do |email|
@registered_user = create(:user,
... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/features/step_definitions/email_steps.rb | features/step_definitions/email_steps.rb | # Commonly used email steps
#
# To add your own steps make a custom_email_steps.rb
# The provided methods are:
#
# last_email_address
# reset_mailer
# open_last_email
# visit_in_email
# unread_emails_for
# mailbox_for
# current_email
# open_email
# read_emails_for
# find_email
#
# General form for email scenarios are:
... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require "email_spec"
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord ... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/spec/helpers/pages_helper_spec.rb | spec/helpers/pages_helper_spec.rb | require 'spec_helper'
describe PagesHelper do
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/spec/factories/role.rb | spec/factories/role.rb | FactoryGirl.define do
factory :role do
name "admin"
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/spec/factories/user.rb | spec/factories/user.rb | FactoryGirl.define do
factory :user do
sequence(:email) { |n| "john#{n}@doe.com" }
password "password"
password_confirmation "password"
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/spec/controllers/pages_controller_spec.rb | spec/controllers/pages_controller_spec.rb | require 'spec_helper'
describe PagesController do
describe "GET 'index'" do
it "should be successful" do
get 'index'
response.should be_success
end
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/spec/controllers/admin/base_controller_spec.rb | spec/controllers/admin/base_controller_spec.rb | require 'spec_helper'
describe Admin::BaseController do
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/spec/controllers/admin/users_controller_spec.rb | spec/controllers/admin/users_controller_spec.rb | require 'spec_helper'
describe Admin::UsersController do
let(:user) { mock_model(User) }
before do
controller.stub(:current_user).and_return(user)
user.should_receive(:admin?).and_return(true)
end
describe "GET 'index'" do
it "assigns all users as @users" do
User.stub_chain(:search, :res... | ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
renderedtext/base-app | https://github.com/renderedtext/base-app/blob/a90c8bb8649cff2b05de8ae59ea07b40cde392bd/spec/models/role_spec.rb | spec/models/role_spec.rb | require 'spec_helper'
describe Role do
it { should have_db_column(:name).of_type(:string) }
it { should have_and_belong_to_many(:users) }
describe ".admin" do
it "returns role with name 'admin'" do
role = Role.admin
role.name.should == "admin"
end
end
end
| ruby | MIT | a90c8bb8649cff2b05de8ae59ea07b40cde392bd | 2026-01-04T17:58:16.689142Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.