Class: Foobara::CommandRegistry::AllowedRule

Inherits:
Object
  • Object
show all
Defined in:
foobara-0.0.110/projects/command_connectors/src/command_registry/allowed_rule.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol: nil, explanation: nil, &block) ⇒ AllowedRule

Returns a new instance of AllowedRule.



18
19
20
21
22
# File 'foobara-0.0.110/projects/command_connectors/src/command_registry/allowed_rule.rb', line 18

def initialize(symbol: nil, explanation: nil, &block)
  self.symbol = symbol
  self.block = block
  self.explanation = explanation || symbol
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



16
17
18
# File 'foobara-0.0.110/projects/command_connectors/src/command_registry/allowed_rule.rb', line 16

def block
  @block
end

#explanationObject

Returns the value of attribute explanation.



16
17
18
# File 'foobara-0.0.110/projects/command_connectors/src/command_registry/allowed_rule.rb', line 16

def explanation
  @explanation
end

#symbolObject

Returns the value of attribute symbol.



16
17
18
# File 'foobara-0.0.110/projects/command_connectors/src/command_registry/allowed_rule.rb', line 16

def symbol
  @symbol
end

Class Method Details

.allowed_rule_attributes_typeObject



6
7
8
9
10
11
12
13
# File 'foobara-0.0.110/projects/command_connectors/src/command_registry/allowed_rule.rb', line 6

def allowed_rule_attributes_type
  @allowed_rule_attributes_type ||= GlobalDomain.foobara_type_from_declaration(
    symbol: :symbol,
    # TODO: add a function type and a way to union two types so that we can string or function type checking
    explanation: :duck,
    logic: :duck
  )
end

Instance Method Details

#to_procObject



24
25
26
# File 'foobara-0.0.110/projects/command_connectors/src/command_registry/allowed_rule.rb', line 24

def to_proc
  block
end