Sha256: 148aff8ec2671537e3d76307c54e35214ee8b92b0cb6a6887361f89550a71a55
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
class Pen attr_reader :written, :color def initialize(color = :black) @color = color @written = [] end def write(string) @written << string string end def write_block(&block) string = yield @written << string string end def write_hello write("hello") end def write_array(*args) args.each do |arg| write(arg) end end def greet(hello = "hello", name) write("#{hello} #{name}") end def public_method end def another "another" end def opt_kwargs(required, opt: nil, opt2: nil) [required, opt: opt, opt2: opt2] end def keyrest(**kwargs) kwargs end def req_kwargs(req1:, req2:) [req1, req2] end protected def protected_method end private def private_method end class << self def another "another" end def public_method end protected def protected_method end private def private_method end end end Pen.define_singleton_method(:meta_class_method) do "meta_class_method".freeze end Pen.send(:define_method, :meta_method) do "meta_method".freeze end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spy-1.0.1 | test/support/pen.rb |
spy-1.0.0 | test/support/pen.rb |