Class: Conflisp::DSL
- Inherits:
-
Object
- Object
- Conflisp::DSL
- Defined in:
- lib/conflisp/dsl.rb
Overview
A nice helper DSL for building up Conflisp languages
Instance Attribute Summary collapse
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
Class Method Summary collapse
Instance Method Summary collapse
- #fn(name, implementation) ⇒ Object
-
#initialize(registry:) ⇒ DSL
constructor
A new instance of DSL.
Constructor Details
#initialize(registry:) ⇒ DSL
Returns a new instance of DSL.
15 16 17 |
# File 'lib/conflisp/dsl.rb', line 15 def initialize(registry:) @registry = registry end |
Instance Attribute Details
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
6 7 8 |
# File 'lib/conflisp/dsl.rb', line 6 def registry @registry end |
Class Method Details
.define(&block) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/conflisp/dsl.rb', line 8 def self.define(&block) registry = {} dsl = new(registry: registry) dsl.instance_exec(&block) registry end |
Instance Method Details
#fn(name, implementation) ⇒ Object
19 20 21 |
# File 'lib/conflisp/dsl.rb', line 19 def fn(name, implementation) registry[name.to_s] = implementation end |