Sha256: ae58e42ea1a0f58e4a244c1c6908f8e7c07e7e889b091058eed8b70aeadf09be

Contents?: true

Size: 351 Bytes

Versions: 2

Compression:

Stored size: 351 Bytes

Contents

require "patternmatching"

include PatternMatching

class Foo 
  def initialize
    @name = "Foo"
  end
  attr :name

  def bar
    make "bar" do
      seems as {:val} do
        @name = val
      end
    end
  end
  
  func(:buzz).seems as {:val} do 
    @name = val
  end
end

o = Foo.new
o.bar
p o.name #=> "bar"
o.buzz("buzz")
p o.name #=> "buzz"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
patternmatching-0.1.4 examples/match_inside_class.rb
patternmatching-0.1.3 examples/match_inside_class.rb