code
stringlengths
1
1.73M
language
stringclasses
1 value
class Leadership < FeatModel @bonus_classes = [] def initialize super @title = "Leadership" @bonus_classes = [] @description = "Having this feat enables the character to attract loyal companions and devoted followers, subordinates who assist her. " @page = "PHB??" @link = "http://www.d20srd.org/...
Ruby
#require "FeatList" # require 'pathname' # require Pathname(__FILE__).ascend{|d| h=d+'FeatList.rb'; break h if h.file?} class DeftHands < FeatModel def initialize super @title = "Deft Hands" @bonus_classes = [] @description = "+2 Bonus on Sleight of Hand and Use Rope checks" @page = "PHB93" ...
Ruby
class CombatCasting < FeatModel def initialize super @title = "Combat Casting" @description = "You get a +4 bonus on Concentration checks made to cast a spell or use a spell-like ability while on the defensive or while you are grappling or pinned." @page = "PHB??" @link = "" end def self.ava...
Ruby
# ClericSpells - List of D&D Spells[SpellModel] for Cleric # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General ...
Ruby
# RangerSpells - List of D&D Spells[SpellModel] for Ranger # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU Ge...
Ruby
# SorcererSpells - List of D&D Spells[SpellModel] for Sorcerer # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GN...
Ruby
# DruidSpells - List of D&D Spells[SpellModel] for Druid # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU Gene...
Ruby
# BardSpells - List of D&D Spells[SpellModel] for Bard # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU Genera...
Ruby
# PaladinSpells - List of D&D Spells[SpellModel] for Paladin # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU ...
Ruby
SpellList.granted_powers_list["Air Domain"] = "Turn or destroy earth creatures as a good cleric turns undead." + "Rebuke, command, or bolster air creatures as an evil cleric rebukes undead." + "Use these abilities a total number of times per day equal to 3 + your Charisma modifier." SpellList.granted_powers_procs...
Ruby
# WizardSpells - List of D&D Spells[SpellModel] for Wizard # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU Ge...
Ruby
# Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Fo...
Ruby
# Storm Giant - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms ...
Ruby
# Lizardfolk - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms o...
Ruby
# Gnoll - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the...
Ruby
# Drow - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the ...
Ruby
# Tiefling - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of ...
Ruby
# Stone Giant - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms ...
Ruby
# Half-Dragon - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms ...
Ruby
# Aquatic Elf - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms ...
Ruby
# Azer - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the ...
Ruby
# Medusa - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of th...
Ruby
# Kobold - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of th...
Ruby
# Hill Giant - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms o...
Ruby
# Wild Elf - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of ...
Ruby
# Troll - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the...
Ruby
# Minotaur - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of ...
Ruby
# Vampire - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of t...
Ruby
# Orc - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the G...
Ruby
# Gray Elf - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of ...
Ruby
# Goblin - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of th...
Ruby
# Troglodyte - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms o...
Ruby
# Fire Giant - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms o...
Ruby
# Cloud Giant - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms ...
Ruby
# Ogre Mage - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of...
Ruby
# Ogre - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the ...
Ruby
# Half-Celestial - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the ter...
Ruby
# Aasimar - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of t...
Ruby
# Hobgoblin - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of...
Ruby
# Half-Fiend - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms o...
Ruby
# Doppleganger - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms...
Ruby
# Frost Giant - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms ...
Ruby
# Wood Elf - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of ...
Ruby
# Rakshasa - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of ...
Ruby
# ClassModel - Model of D&D classes and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the term...
Ruby
# SkillModel - Model of D&D spells and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms...
Ruby
#SPOOT
Ruby
# RaceModel - Model of D&D race and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of...
Ruby
# SkillModel - Model of D&D skills and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms...
Ruby
# FeatModel - Model of D&D feats and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms o...
Ruby
# Roll - manager for string based dice rolls # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public L...
Ruby
# SpellList - Manager of D&D spells[SpellModel], spell generation and container for related methods # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or m...
Ruby
# ClassList - Manager of D&D Classes[ClassModel] # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General Publ...
Ruby
# FeatList - Manager of D&D Feats[FeatModel] # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public L...
Ruby
# SkillList - Manager of D&D skills[SkillModel], skill generation and container for related methods # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or m...
Ruby
# RaceList - Manager of D&D Races[RaceModel] # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public L...
Ruby
# LanguageList - Manager of D&D Languages[String] # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General Pub...
Ruby
# Skills - List of D&D Skills[SkillModel] # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Lice...
Ruby
# Languages - Manager of D&D Languages[String] # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public...
Ruby
class Name attr_accessor :name, :pre, :post @@tokens = Hash.new(Hash.new(Hash.new([]))) @token_categories = ["General"] @alignment="" def self.load(relative_path="Names") Dir.glob(File.join("#{File.dirname(__FILE__)}", "/*/*.txt")).each do |file| #Dir.glob(File.join(".", "*/*.txt")).each do |file| ...
Ruby
class Background attr_accessor :primary_motivation, :secondary_motivation, :history @@background = Hash.new([]) @result = "" @alignment="" def self.load(relative_path="Backgrounds") Dir.glob(File.join("#{File.dirname(__FILE__)}", "/*.txt")).each do |file| File.open(file, "r") do |file| while(l...
Ruby
require_relative "Character" #require_relative "Lists" temp = ["PHB", "MM1"]#, "mm1","eberron","forgotten realms","frostburn"] temp.each { |book| Dir.glob("./**/"+book+"/*Races/*.rb").each {|file| require file} } temp.each { |book| Dir.glob("./**/"+book+"/*Classes/*.rb").each {|file| require file} } temp.each { ...
Ruby
# Character - Model for D&D characters and container for related information # Copyright (C) 2011 Cody Garrett, Josh Murphy, and Matt Ingram # This file is part of FishTornado D&D Character Generator. # FishTornado D&D Character Generator is free software: you can redistribute it and/or modify # it under the t...
Ruby
require_relative "#{File.dirname(__FILE__)}/Character_Generator" print "Number of characters to generate: " number_of_characters = gets.chomp print "Character level: " char_level = gets.chomp if (char_level.to_i > 1) print "Number of classes: " num_classes = gets.chomp else num_classes = 1 end =begin ...
Ruby
class RaceList $phb = ["Human","Elf","Half-Elf","Halfling","Gnome","Half-Orc","Dwarf"] $mm1 = ["Drow","Orc","Troll","Lizardfolk", "Hill Giant", "Frost Giant", "Cloud Giant", "Fire Giant","Stone Giant", "Storm Giant", "Doppleganger","Eladrin","Gnoll", "Half-Dragon", "Half-Fiend","Kobold","Medusa", "Ogre", "Ogre ...
Ruby
#require "RaceList" require 'pathname' require Pathname(__FILE__).ascend{|d| h=d+'Lists.rb'; break h if h.file?} class Dwarf def self.apply(char) age = 40 (1..7).each do |i| age += (rand(6)+1) end char.race= self char.speed =20 char.age = age#agew(7.d6+40) char.stats["con"] += 2 char....
Ruby
require Pathname(__FILE__).ascend{|d| h=d+'Lists.rb'; break h if h.file?} class Human def self.apply(char) age = 15 (1..2).each do |i| age += (rand(6)+1) end char.race= self char.speed = 30 char.age = age#agew(7.d6+40) end end RaceList.push(Human)
Ruby
#require "RaceList" require 'pathname' require Pathname(__FILE__).ascend{|d| h=d+'ClassList.rb'; break h if h.file?} class Rogue < ClassModel def self.Class_skills ["Appraise","Balance","Bluff","Climb","Craft", "Decipher Script","Diplomacy","Disable Device","Disguise", "Escape Artist","Forgery","Gather Inf...
Ruby
class ClassModel attr_accessor :good_save,:bad_save,:good_bab,:mid_bab,:bad_bab @@hd = "1d4" def self.Class_skills Class_skills end def self.Skill_mul 2 end def self.apply(character) character.classes.push(self.new) end def self.available?(character) return true end def self.clas...
Ruby
SPOOT
Ruby
class SkillModel attr_accessor :name, :ranks, :description,:mod,:armor_check, :bonus_hash, :restricted, :circumstance_hash #bonus_hash should contain reason as key and bonus as value #circumstance_hash should contain reason as key and bonus as value def initialize (name, mod="wis",armor_check=false, description...
Ruby
# Roll - manager for string based dice rolls # Copyright (C) 2011 Cody Garrett # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any ...
Ruby
require_relative "../Models/ClassModel" class ClassList @@list=Hash.new def list return @@list end def self.push(classs) @@list[classs.to_s] = classs end def self.list return @@list end end
Ruby
require_relative "../Models/SkillModel" require_relative "Skills" class SkillList @@list=[] #default skills available attr_accessor :skills #skills the character has ranks in or wants to be printed attr_accessor :class_skills def initialize @skills=[] @class_skills=[] end def list return @@list...
Ruby
puts "spoot"*5000000
Ruby
require_relative "SkillList" require_relative "../Models/SkillModel" class Skills def initialize SkillList.load_skills( [["Appraise","int"], ["Balance","dex",true], ["Bluff","cha"], ["Climb","str",true,], ["Concentration","con"], ["Craft","int"], ["Decipher Script","int"], ["Diplomacy"...
Ruby
class RaceList @@RaceList=Hash.new def RaceList return @@RaceList end def self.push(race) @@RaceList[race.to_s] = race end def self.list return @@RaceList end end class ClassList @@list=Hash.new def list return @@list end def self.push(classs) @@list[classs.to_s] = classs end ...
Ruby
class CharacterGen2 source_selector = {php_races[] => "php", mm1[] => "mm1", mm2[] => "mm2", mm3[] => "mm3"} php_races[] = ["Human", "Elf", "Dwarf", "Halfing", "Half-Elf", "Half-Orc"][] forgotten_realms_races[] = ["Fey'ri", "Air Genasi", "Water Genasi", "Earth Genasi", "Water Genasi", "Tiefling", "Aasimar", "Svi...
Ruby
require_relative "Character" require_relative "Lists" temp = ["PHB"]#, "mm1","eberron","forgotten realms","frostburn"] temp.each { |book| Dir.glob("./**/"+book+"/*Races/*.rb").each {|file| require file} } temp.each { |book| Dir.glob("./**/"+book+"/*Classes/*.rb").each {|file| require file} } 1.times do |i| ...
Ruby
#require_relative "./Books/PHB/Races/RaceList" #require_relative "./Books/PHB/Races/ClassList" require_relative "./Lists/SkillList" require_relative "./Lists/ClassList" class Character #attr_accessor :str, :dex, :con, :int, :wis, :cha, attr_accessor :stats, :skill_points, :HP, :speed, :ability_mods, :ac_list...
Ruby
require_relative "RaceList" temp = ["phb", "mm1","eberron","forgotten realms","frostburn"] occurance = Hash.new list = RaceList.new books.each { |book| Dir.glob("./**/"+book+"/*.rb").each {|file| require file} } (1..50).each do |i| race = list.get_race(temp) if race[1] race_name = race[1] + " " + race[0...
Ruby
# coding: utf-8 # Title: LightPack API wrapper for Ruby # Author: Mikhail S. Pobolovets # License: GPL v3 # Date: 2011/08/15 # API Version: 5.5 require 'socket' class LightPack include Socket::Constants # host = '127.0.0.1' # The remote host # port = 3636 ...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Full error repor...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.ca...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between...
Ruby
# Be sure to restart your web server when you modify this file. # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION ...
Ruby
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) unless defined?(Rails::Initializer) if File.directory?("#{RAILS_ROOT}/vendor/rails") require "#{RAILS_ROOT}/vendor/rails/railties/lib/init...
Ruby
ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # ...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper end
Ruby
module OptimizedSearchHelper end
Ruby
module RequestHelper end
Ruby
module SearchHelper end
Ruby
class Segment < ActiveRecord::Base has_and_belongs_to_many :corpora before_create :size_init private def size_init self.size = 0 if self.size.nil? end end
Ruby
require 'simple-json' class Corpus < ActiveRecord::Base has_and_belongs_to_many :segments @@parser = JsonParser.new def to_setence_by_strings json_data = @@parser.parse(self.json) data = {"id" => self.id,"text" => self.text} #cashe left_side context index = -1 if self.left_side.blank? ...
Ruby
class RequestController < ApplicationController def index render :text => "" end def corpus_tags data = {"info" => [{"enable_tags" => ['tag_name1','tag_name2'],"part_of_speech" => ['item1']}]} respond_to do |format| format.js{ render_json data } end end end
Ruby
require "yaml" class OptimizedSearchController < ApplicationController include TestInputGenerator include EncodeToSQL before_filter :split_keywords_by_space, :except => [:index,:sentences_by_word_sequence,:list_by_word_sequence,:around_sentences] before_filter :analyze_json_keyw...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. require 'simple-json' class ApplicationController < ActionController::Base # Pick a unique cookie name to distinguish our session data from others' session :sessio...
Ruby
require 'lib/test_input_generator' class SearchController < ApplicationController include TestInputGenerator include EncodeToSQL before_filter :test_sentences_by_word_sequence, :except => :index before_filter :split_keywords_by_space, :except => [:index,:sentences_by_word_seq...
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/breakpointer'
Ruby