Class: RKit::Dsl::Base
- Inherits:
-
Object
show all
- Includes:
- Thrust
- Defined in:
- lib/r_kit/dsl/base.rb,
lib/r_kit/dsl/base/thrust.rb
Defined Under Namespace
Modules: LocalParams, Thrust
Classes: Params, Readonly
Constant Summary
collapse
- @@dsls =
Hash.new{ |hash, key| hash[key] = Array.new }
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(base) ⇒ Base
Returns a new instance of Base.
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/r_kit/dsl/base.rb', line 10
def initialize base
@base = base
@methods = Hash.new{ |hash, key| hash[key] = proc{} }
@methods[:allowance] = proc{ true }
@methods[:restriction] = proc{ raise DslStandardError.new(self, method_name: __method__) }
@params = RKit::Dsl::Base::Params.new(->(){})
end
|
Instance Attribute Details
Returns the value of attribute base.
8
9
10
|
# File 'lib/r_kit/dsl/base.rb', line 8
def base
@base
end
|
Class Method Details
4
5
6
|
# File 'lib/r_kit/dsl/base.rb', line 4
def self.dsls
@@dsls
end
|
Instance Method Details
#allowed?(&block) ⇒ Boolean
48
49
50
|
# File 'lib/r_kit/dsl/base.rb', line 48
def allowed? &block
methods :allowance, &block
end
|
#domain(domain) ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/r_kit/dsl/base.rb', line 31
def domain domain
raise DslDefinitionError.new(@base) if [@name, @method].none?
@domain = domain
thrust_dsl!
thrust_dsl_interface!
thrust_dsl_options!
thrust_dsl_extend!
end
|
#method(method) ⇒ Object
26
27
28
|
# File 'lib/r_kit/dsl/base.rb', line 26
def method method
@method = method
end
|
#methods(context, &block) ⇒ Object
56
57
58
|
# File 'lib/r_kit/dsl/base.rb', line 56
def methods context, &block
@methods[context] = block
end
|
#name(name) ⇒ Object
22
23
24
|
# File 'lib/r_kit/dsl/base.rb', line 22
def name name
@name = name
end
|
#params(params_lambda) ⇒ Object
43
44
45
|
# File 'lib/r_kit/dsl/base.rb', line 43
def params params_lambda
@params = RKit::Dsl::Base::Params.new(params_lambda)
end
|
#restricted(&block) ⇒ Object
52
53
54
|
# File 'lib/r_kit/dsl/base.rb', line 52
def restricted &block
methods :restriction, &block
end
|