code
stringlengths
1
1.73M
language
stringclasses
1 value
#!c:/ruby/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log #...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like: # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired...
Ruby
#!c:/ruby/bin/ruby # # You may specify the path to the FastCGI crash log (a log of unhandled # exceptions which forced the FastCGI instance to exit, great for debugging) # and the number of requests to process before running garbage collection. # # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log #...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'test_help' class Test::Unit::TestCase # Transactional fixtures accelerate your tests by wrapping each test method # in a transaction that's rolled back on completion. This ensures that the # test datab...
Ruby
module Constants API_TOKEN = "insert your api token here" end
Ruby
#!/usr/bin/ruby # # jQTouch demo with Brightcove Media API # require 'rubygems' require 'sinatra' require 'net/http' require 'haml' require 'constants' get '/' do haml :index end get '/playlists.json' do http = Net::HTTP.new('api.brightcove.com', 80) resp, data = http.get("/services/library?command=find_all_pl...
Ruby
# Configuration file for running Sinatra on a Dreamhost website with Passenger # # Before running, confirm this directory structure: # <application root directory> # - log # - tmp # - public # load local gems require '/path/to/.gem/ruby/1.8/gems/rack-1.1.0/lib/rack.rb' require '/path/to/.gem/r...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
Ruby
# Be sure to restart your server when you modify this file. Bridgescore::Application.config.session_store :cookie_store, :key => '_bridgescore_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table wi...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
Ruby
Bridgescore::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turne...
Ruby
Bridgescore::Application.configure do # Settings specified here will take precedence over those in config/application.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 w...
Ruby
Bridgescore::Application.configure do # Settings specified here will take precedence over those in config/application.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 t...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application Bridgescore::Application.initialize!
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Ruby
require File.expand_path('../boot', __FILE__) require 'rails/all' # If you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) if defined?(Bundler) module Bridgescore class Application < Rails::Application ...
Ruby
Bridgescore::Application.routes.draw do # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'products/:id' => 'catalog#view' match 'scores/:player_id/:board_id/new' => 'scores#new', :as => :new_score # Keep in mind you can assign values o...
Ruby
module ApplicationHelper end
Ruby
class Player < ActiveRecord::Base has_many :scores end
Ruby
class Board < ActiveRecord::Base def hand(id) case id when 0 theHand = self.hand_0 when 1 theHand = self.hand_1 when 2 theHand = self.hand_2 when 3 theHand = self.hand_3 end end end
Ruby
class Score < ActiveRecord::Base belongs_to :player def position case hand_id when 0 "North" when 1 "South" when 2 "East" when 3 "West" end end end
Ruby
class BoardsController < ApplicationController def new @b = Board.new end def create Board.create(params[:board]) puts params.inspect redirect_to players_path end def index @boards = Board.find :all end def edit @b = Board.find params[:id] end def update @board = Board.find params[:id] if @board....
Ruby
class ScoresController < ApplicationController def new @s = Score.find_by_player_id_and_board_id params[:player_id], params[:board_id] @b = Board.find params[:board_id] if @s.nil? @s = Score.new @s.player_id = params[:player_id] @s.board_id = params[:board_id] end end def create Score.create(param...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
class PlayersController < ApplicationController def new @p = Player.new end def create Player.create(params[:player]) redirect_to players_path end def index @boards = Board.find :all @players = Player.find :all @scores = Score.find :all end def edit @p = Player.find params[:id] end def update @...
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.expand_path('../config/application', __FILE__) require 'rake' Bridgescore::Application.load_tasks
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
source 'http://rubygems.org' gem 'rails', '3.0.7' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Use unicorn as the web server # gem 'unicorn' # Deploy with Capistrano # gem 'capistrano' # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1....
Ruby
class CreatePlayers < ActiveRecord::Migration def self.up create_table :players do |t| t.integer :id t.string :name t.timestamps end end def self.down drop_table :players end end
Ruby
class CreateBoards < ActiveRecord::Migration def self.up create_table :boards do |t| t.integer :id t.string :hand_0 t.string :hand_1 t.string :hand_2 t.string :hand_3 t.timestamps end end def self.down drop_table :boards end end
Ruby
class CreateScores < ActiveRecord::Migration def self.up create_table :scores do |t| t.integer :id t.integer :player_id t.integer :board_id t.integer :hand_id t.integer :contract_tricks t.string :contract_suit t.integer :score t.boolean :vuln t.boolean :doubled ...
Ruby
# 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
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Bridgescore::Application
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
require 'net/smtp' require 'net/http' #some variables to set emailUsername = '' emailPassword = '' breweryUrl = 'http://surlybrewing.com/tours/tourregistration.php' #weird syntax in ruby to create a block of text (called a 'here document') and also sets the subject for the email msgstr = <<END_OF_MESSAGE Subject: Sur...
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
#! ruby require 'rexml/document' # Create Google Code Wiki pages for the rule sets. # @author Peter Kofler @lines = [] # Redefine puts not to print _msg_ to buffer. def puts(msg) # print msg # print "\n" @lines << "#{msg}\n" end # Get the contents from _text_ DOM and normalize it. def norm_tex...
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'data_mapper', '~> 1.2' gem 'dm-postgres-adapter' gem 'google-api-client', '>= 0.4.3' group :development do gem 'dm-sqlite-adapter', '~> 1.2' gem 'do_sqlite3', '~> 0.10' end
Ruby
# 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
class CreateBids < ActiveRecord::Migration def self.up create_table :bids do |t| t.integer :id t.integer :game_id t.integer :player_id t.integer :value t.string :suit t.timestamps end end def self.down drop_table :bids end end
Ruby
class CreateTricks < ActiveRecord::Migration def self.up create_table :tricks do |t| t.integer :game_id t.integer :cards_played t.integer :card_0_id t.integer :card_1_id t.integer :card_2_id t.integer :card_3_id t.integer :player_0_id t.integer :player_1_id t.int...
Ruby
class CreateCards < ActiveRecord::Migration def self.up create_table :cards do |t| t.integer :id t.integer :player_id t.string :suit t.integer :value t.timestamps end end def self.down drop_table :cards end end
Ruby
class CreateGames < ActiveRecord::Migration def self.up create_table :games do |t| t.integer :id t.integer :active_player_id t.string :contract_suit t.integer :contract_value t.integer :contract_double_or_redouble t.integer :contract_player t.boolean :contract_final t.integer :passes ...
Ruby
class CreatePlayers < ActiveRecord::Migration def self.up create_table :players do |t| t.integer :id t.integer :game_id t.string :name t.string :password t.integer :partner_id t.integer :position t.integer :above_line t.integer :below_line t.integer :tricks_won ...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
source 'http://rubygems.org' gem 'rails', '3.0.3' gem 'jquery-rails' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3-ruby', :require => 'sqlite3' # Use unicorn as the web server # gem 'unicorn' # Deploy with Capistrano # gem 'capistrano' # To use debugger (ruby-...
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
module ApplicationHelper def set_focus_to_id(id) javascript_tag("$('##{id}').focus()"); end end
Ruby
class Card < ActiveRecord::Base belongs_to :player has_one :trick, :foreign_key => 'card_0_id' has_one :trick, :foreign_key => 'card_1_id' has_one :trick, :foreign_key => 'card_2_id' has_one :trick, :foreign_key => 'card_3_id' def pp case self.value when 11 result = "J" when 12 result = "Q" when 13...
Ruby
class Player < ActiveRecord::Base has_many :cards, :dependent => :destroy has_many :bids, :dependent => :destroy has_one :partner, :class_name => 'Player', :foreign_key => :partner_id has_many :tricks, :foreign_key => 'player_0_id' has_many :tricks, :foreign_key => 'player_1_id' has_many :tricks, :foreign_key => ...
Ruby
class Game < ActiveRecord::Base has_many :players, :dependent => :destroy has_many :bids, :dependent => :destroy has_many :tricks, :dependent => :destroy belongs_to :current_trick, :class_name => 'Trick' accepts_nested_attributes_for :players def north self.players.select{|p| p.position == 1}[0] end def sou...
Ruby
class Trick < ActiveRecord::Base belongs_to :game, :class_name => 'Game' has_one :game_fk, :class_name => 'Game', :foreign_key => :current_trick_id belongs_to :player_0, :class_name => 'Player' belongs_to :player_1, :class_name => 'Player' belongs_to :player_2, :class_name => 'Player' belongs_to :player_3, :class...
Ruby
class Bid < ActiveRecord::Base belongs_to :game belongs_to :player def pretty case value when 10 result = "Dbl" when 11 result = "re" when 0 result = "pass" else result = "#{value}#{suit}" end return result end end
Ruby
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
class PlayersController < ActionController::Base def new @game_id = params[:id] @position = params[:position] @player_id = params[:player_id] if @player_id == "0" @player = Player.new else @player = Player.find @player_id end end def create if params[:player_id] == "0" @player = Player.create(...
Ruby
class GamesController < ActionController::Base def new puts "------------------------------------------GAMES#NEW--------------------------------------" @game = Game.new @game.players.build end def index puts "------------------------------------------GAMES#INDEX--------------------------------------" sess...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. Bridge::Application.config.session_store :cookie_store, :key => '_bridge_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rails ...
Ruby
Bridge::Application.routes.draw do # The priority is based upon order of creation: # first created -> highest priority. # Sample of regular route: # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: # match 'produc...
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. gemfile = File.expand_path('../../Gemfile', __FILE__) begin ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' Bundler.setup rescue Bundler::GemNotFound => e STDERR.puts e.message STDERR.puts "Try running `bundle install`." exit! end if File.exist?(gem...
Ruby
require File.expand_path('../boot', __FILE__) require 'rails/all' # If you have a Gemfile, require the gems listed there, including any gems # you've limited to :test, :development, or :production. Bundler.require(:default, Rails.env) if defined?(Bundler) module Bridge class Application < Rails::Application # ...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application Bridge::Application.initialize!
Ruby
Bridge::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on ...
Ruby
Bridge::Application.configure do # Settings specified here will take precedence over those in config/application.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 webser...
Ruby
Bridge::Application.configure do # Settings specified here will take precedence over those in config/application.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 s...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Bridge::Application
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.expand_path('../config/application', __FILE__) require 'rake' Bridge::Application.load_tasks
Ruby
# # This temporary test driver tracks progress on getting HTML5lib working # on Ruby 1.9. Prereqs of Hoe, Hpricot, and UniversalDetector will be # required to complete this. # # Once all the tests pass, this file should be deleted # require 'test/test_cli' # requires UniversalDetector # require 'test/test_encoding'...
Ruby
require 'rake' require 'hoe' require 'lib/html5/version' Hoe.new("html5", HTML5::VERSION) do |p| p.name = "html5" p.description = p.paragraphs_of('README', 2..5).join("\n\n") p.summary = "HTML5 parser/tokenizer." p.author = ['Ryan King'] # TODO: add more names p.email = 'ryan@theryanking.com' p.url ...
Ruby
require 'html5/html5parser' require 'html5/version' module HTML5 def self.parse(stream, options={}) HTMLParser.parse(stream, options) end def self.parse_fragment(stream, options={}) HTMLParser.parse_fragment(stream, options) end end
Ruby
# Warning: this module is experimental and subject to change and even removal # at any time. # # For background/rationale, see: # * http://www.intertwingly.net/blog/2007/01/08/Xhtml5lib # * http://tinyurl.com/ylfj8k (and follow-ups) # # References: # * http://googlereader.blogspot.com/2005/12/xml-errors-in-feeds....
Ruby
require 'stringio' require 'html5/constants' module HTML5 # Provides a unicode stream of characters to the HTMLTokenizer. # This class takes care of character encoding and removing or replacing # incorrect byte-sequences and also provides column and line tracking. class HTMLInputStream attr_accessor :q...
Ruby
require 'html5/constants' module HTML5 class HTMLSerializer def self.serialize(stream, options = {}) new(options).serialize(stream, options[:encoding]) end def escape(string) string.gsub("&", "&amp;").gsub("<", "&lt;").gsub(">", "&gt;") end def initialize(options={}) @quote...
Ruby
require 'html5/serializer/htmlserializer' module HTML5 class XHTMLSerializer < HTMLSerializer DEFAULTS = { :quote_attr_values => true, :minimize_boolean_attributes => false, :use_trailing_solidus => true, :escape_lt_in_attrs => true, :omit_optional_tags ...
Ruby
$:.unshift File.dirname(__FILE__), 'lib' require 'html5' require 'ostruct' require 'optparse' module HTML5::CLI def self.parse_opts argv options = OpenStruct.new options.profile = false options.time = false options.output = :html options.treebuilder = 'simpletree' ...
Ruby
module HTML5 class EOF < Exception; end def self._(str); str end CONTENT_MODEL_FLAGS = [ :PCDATA, :RCDATA, :CDATA, :PLAINTEXT ] SCOPING_ELEMENTS = %w[ applet button caption html marquee object table td th ] FORMATTING_ELEME...
Ruby
require 'cgi' require 'html5/tokenizer' require 'set' module HTML5 # This module provides sanitization of XHTML+MathML+SVG # and of inline style attributes. # # It can be either at the Tokenizer stage: # # HTMLParser.parse(html, :tokenizer => HTMLSanitizer) # # or, if you already have a parse tree (in this exam...
Ruby
module HTML5 VERSION = '0.10.1' end
Ruby
require 'html5/treewalkers/base' module HTML5 module TreeWalkers class << self def [](name) case name.to_s.downcase when 'simpletree' require 'html5/treewalkers/simpletree' SimpleTree::TreeWalker when 'rexml' require 'html5/treewalkers/rexml' ...
Ruby
module HTML5 module TreeBuilders class << self def [](name) case name.to_s.downcase when 'simpletree' then require 'html5/treebuilders/simpletree' SimpleTree::TreeBuilder when 'rexml' then require 'html5/treebuilders/rexml' REXML::TreeBuilder ...
Ruby
require 'html5/treebuilders/base' require 'rubygems' require 'hpricot' require 'forwardable' module HTML5 module TreeBuilders module Hpricot class Node < Base::Node extend Forwardable def_delegators :@hpricot, :name attr_accessor :hpricot def initialize(name) s...
Ruby
require 'html5/treebuilders/base' require 'rexml/document' require 'forwardable' module HTML5 module TreeBuilders module REXML class Node < Base::Node extend Forwardable def_delegators :@rxobj, :name, :attributes attr_accessor :rxobj def initialize name super nam...
Ruby
require 'html5/constants' #XXX - TODO; make the default interface more ElementTree-like rather than DOM-like module HTML5 # The scope markers are inserted when entering buttons, object elements, # marquees, table cells, and table captions, and are used to prevent formatting # from "leaking" into tables, button...
Ruby
require 'html5/treebuilders/base' module HTML5 module TreeBuilders module SimpleTree class Node < Base::Node # Node representing an item in the tree. # name - The tag name associated with the node attr_accessor :name # The value of the current node (applies to text nodes a...
Ruby
module HTML5 module Sniffer # 4.7.4 def html_or_feed str s = str[0, 512] # steps 1, 2 pos = 0 while pos < s.length case s[pos] when ?\t, ?\ , ?\n, ?\r # 0x09, 0x20, 0x0A, 0x0D == tab, space, LF, CR pos += 1 when ?< # 0x3C pos += 1 if s[pos..pos+2] == "!--" # [0...
Ruby
require 'html5/serializer/htmlserializer' require 'html5/serializer/xhtmlserializer'
Ruby