Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

/child_class.rb Secret

Created July 20, 2016 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2478c472c1866a8c0b4f2c00705443cf to your computer and use it in GitHub Desktop.
Save anonymous/2478c472c1866a8c0b4f2c00705443cf to your computer and use it in GitHub Desktop.
require 'nokogiri'
class ChildClass < Nokogiri::XML::Document
attr_reader :whatever
def initialize(whatever)
@whatever = whatever
end
end
ChildClass.new(500) # ==> no implicit conversion of Fixnum into String
ChildClass.new('X') # ==> wrong number of arguments (given 0, expected 1)
# This file is part of Nokogiri
module Nokogiri
module XML
class Document < Nokogiri::XML::Node
# ...
def initialize *args
@errors = []
@decorators = []
end
# ...
end
end
end
# This file is part of Nokogiri
module Nokogiri
module XML
class Node
# ...
def initialize name, document
# Empty
end
# ...
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment