Sha256: 4bf44c6323e45fc6b42179e4c2cc9694ae0cfbd90f080b47229e17fae211213a

Contents?: true

Size: 359 Bytes

Versions: 3

Compression:

Stored size: 359 Bytes

Contents

module Surrounded
  module Shortcuts
    private
    
    def define_shortcut(name)
      singleton_class.send(:define_method, name) do |*args|
        instance = self.new(*args)
        instance.public_send(name)
      end
    end

    def store_trigger(*names)
      names.each do |name|
        define_shortcut(name)
      end
      super
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
surrounded-1.0.0 lib/surrounded/shortcuts.rb
surrounded-0.9.11 lib/surrounded/shortcuts.rb
surrounded-0.9.10 lib/surrounded/shortcuts.rb