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 bar; D.new.foo end end | |
| class B; def bar; D.new.foo end end | |
| class C; def bar; D.new.foo end end | |
| class D | |
| def foo; "HELLO WORLD!" end | |
| # Export `foo` to A and B, but not C | |
| export :foo, A, B | |
| 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' | |
| class DefineMethodHandler < YARD::Handlers::Ruby::Base | |
| handles method_call(:define_method) | |
| process { register MethodObject.new(namespace, statement[1].jump(:ident)[0]) } | |
| end | |
| YARD.parse_string(<<-'eof') | |
| class Foo | |
| def self.something |
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' | |
| module YardObject | |
| def source; yard_object.source end | |
| def docstring; yard_object.docstring end | |
| private | |
| def yard_object | |
| fname = source_location[0] |
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' | |
| class IncrementalArray | |
| def initialize(block) | |
| @block = block | |
| @buffer = YARD::Parser::Ruby::Legacy::TokenList.new | |
| end | |
| def shift; fill_buffer; @buffer.shift end | |
| def first; fill_buffer; @buffer.first end | |
| def [](index) fill_buffer; @buffer[index] 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' | |
| class IncrementalArray | |
| def initialize(block) | |
| @block = block | |
| @buffer = YARD::Parser::Ruby::Legacy::TokenList.new | |
| end | |
| def shift; fill_buffer; @buffer.shift end | |
| def first; fill_buffer; @buffer.first end | |
| def [](index) fill_buffer; @buffer[index] 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
| class MyString < String | |
| def foo; reverse + "X" end | |
| end | |
| module Foo | |
| implicit String => MyString | |
| class A | |
| attr_reader :myattr | |
| def initialize |
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 Callbacks | |
| @@callbacks = {} | |
| def has_callback_hook(name) | |
| @@callbacks[name] = [] | |
| class_eval <<-CLASS | |
| def #{name}_add block | |
| @callbacks[#{name}] << block | |
| 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
| # Array#flatten seems to call #to_ary on all elements of the array, regardless | |
| # of whether they are Arrays and without checking if the object has a to_ary first. | |
| # | |
| # More peculiarly, calling "super" inside of method_missing does not return from | |
| # the call to the method_missing method, instead it jumps completely out of | |
| # the call without performing any actions after "super" is called. | |
| # | |
| # Note that Foo.new.respond_to?(:to_ary) == false, so method_missing should raise an | |
| # exception, though it does not. |
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 'tmpdir' | |
| require 'fileutils' | |
| require 'open-uri' | |
| module YARD | |
| module CLI | |
| class Diff < Command | |
| def initialize | |
| super | |
| @list_all = false |
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
| yard (0.6-master)$ yard diff -a yard-0.5.2 yard-0.5.3 | |
| Added objects: | |
| File.read_binary | |
| Gem::Specification#has_yardoc= | |
| YARD::CLI::Base#initialize | |
| YARD::CLI::Yardoc#excluded | |
| YARD::CLI::Yardoc#excluded= | |
| YARD::CLI::Yardoc#incremental | |
| YARD::CLI::Yardoc#incremental= |