No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Arthur Poulet f8791dff78
Merge branch 'master' of github.com:Nephos/RuntimeCall
1 year ago
spec Change structure so it bypass the Recursive Generics bug 2 years ago
src Add escape to yield 1 year ago
.editorconfig Init project 2 years ago
.gitignore Init project 2 years ago
.travis.yml Init project 2 years ago
LICENSE Init project 2 years ago
README.md Update README 1 year ago
shard.yml Init project 2 years ago

README.md

RuntimeCall

Runtime calls in crystal

Looks like “send” in Ruby. It is an internal list of functions defined to be called by their stringified name ("bar" call the function bar(...)).

Installation

Add this to your application’s shard.yml:

dependencies:
  RuntimeCall:
    github: Nephos/RuntimeCall

Usage

require "RuntimeCall"

class Foooo
end

class Foo
  @a : Int32
  def initialize(@a)
  end

  RuntimeCall.extends do
    getter_runtime_call "a"
    define_runtime_call "bar", Int32 do |args|
      @a += args[0]
    end
    define_runtime_call "bar2" do |args|
      Foooo.new
    end
  end
end

foo = Foo.new a: 1
foo.runtime_call "bar", 2
foo.runtime_call "a" # => 3
foo.runtime_call "bar2" # => #<Foo:...>

Development

TODO: Write development instructions here

Contributing

  1. Fork it ( https://github.com/Nephos/RuntimeCall/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am ‘Add some feature’)
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • Nephos Arthur Poulet - creator, maintainer