This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/yard/generators/helpers/markup_helper.rb b/lib/yard/generators/helpers/markup_helper.rb | |
| index 7cb483a..a5d0d33 100644 | |
| --- a/lib/yard/generators/helpers/markup_helper.rb | |
| +++ b/lib/yard/generators/helpers/markup_helper.rb | |
| @@ -1,12 +1,3 @@ | |
| -if RUBY19 | |
| - require 'rdoc/markup' | |
| - require 'rdoc/markup/to_html' | |
| -else | |
| - require 'rdoc/markup/simple_markup' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Benchmark with Clang | |
| void benchmark(char *name, size_t times, void (^block)(void)) { | |
| size_t i; | |
| clock_t t1, t2; | |
| t1 = clock(); | |
| for (i = 0; i < times; i++) block(); | |
| t2 = clock(); | |
| float diff = ((float)t2 - (float)t1) / (float)CLOCKS_PER_SEC; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module MyModule | |
| class << self | |
| def test | |
| real_method | |
| end | |
| private | |
| def real_method | |
| "hi" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'mysql' | |
| class Mysql::Result | |
| def encode(value, encoding = "utf-8") | |
| String === value ? value.force_encoding(encoding) : value | |
| end | |
| def each_utf8(&block) | |
| each_orig do |row| | |
| yield row.map {|col| encode(col) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class A | |
| def read(key) raise NotImplementedError end | |
| alias [] read | |
| end | |
| class B < A | |
| def read(key) puts key end | |
| end | |
| B.new[:x] # NotImplementedError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ODB | |
| def self.new(store = nil) | |
| Database.new(store || HashStore.new) | |
| end | |
| class Database | |
| attr_accessor :store | |
| class << self | |
| attr_accessor :current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rubinius (master)$ ./configure | |
| Using LLVM: no | |
| Checking for function 'backtrace': found! | |
| rubinius (master)$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Post | |
| include ODB::Persistent | |
| attr_accessor :title, :author | |
| def __serialize_key__; title.to_sym end | |
| end | |
| db = ODB.new | |
| post = nil | |
| db.transaction do | |
| post = Post.new.tap {|p| p.title = "x"; p.author = "Joe" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark' | |
| require_relative '../lib/odb' | |
| $db = ODB.new | |
| class MyObj | |
| attr_accessor :__serialize_key__ | |
| include ODB::Persistent | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'yard' | |
| require 'active_support' | |
| require 'set' | |
| class ModelHandler < YARD::Handlers::Ruby::Base | |
| handles :class | |
| def process | |
| return unless statement[1] | |
| sclass = statement[1].source |