class RKit::Dsl::Base
Constants
- DSLS
Attributes
base[RW]
Public Class Methods
dsls()
click to toggle source
# File lib/r_kit/dsl/base.rb, line 4 def self.dsls @dsls end
new(base)
click to toggle source
# File lib/r_kit/dsl/base.rb, line 12 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__) } # TODO: the __method__ return 'initialize', and not the "acts_as_..." that it shoul @params = RKit::Dsl::Base::Params.new(->(){}) end
Public Instance Methods
allowed?(&block)
click to toggle source
# File lib/r_kit/dsl/base.rb, line 61 def allowed? &block methods :allowance, &block end
before(&block)
click to toggle source
# File lib/r_kit/dsl/base.rb, line 49 def before &block methods :before, &block thrust_dsl_callback! end
domain(domain)
click to toggle source
# File lib/r_kit/dsl/base.rb, line 34 def domain domain raise DslDefinitionError.new(@base) if [@name, @method].none? @domain ||= domain shadow domain: domain do |shadow_self| thrust_dsl! thrust_dsl_callback! if @methods[:before] thrust_dsl_interface! thrust_dsl_options! thrust_dsl_extend! end end
method(method)
click to toggle source
# File lib/r_kit/dsl/base.rb, line 29 def method method @method = method end
methods(context, &block)
click to toggle source
# File lib/r_kit/dsl/base.rb, line 69 def methods context, &block @methods[context] = block end
name(name)
click to toggle source
TODO: vérifier l’unicité du “name”
# File lib/r_kit/dsl/base.rb, line 25 def name name @name = name end
params(params_lambda)
click to toggle source
# File lib/r_kit/dsl/base.rb, line 56 def params params_lambda @params = RKit::Dsl::Base::Params.new(params_lambda) end
restricted(&block)
click to toggle source
# File lib/r_kit/dsl/base.rb, line 65 def restricted &block methods :restriction, &block end
Protected Instance Methods
readonly()
click to toggle source
# File lib/r_kit/dsl/base.rb, line 77 def readonly RKit::Dsl::Base::Readonly.new(self) end