Class: PatternMatching::Configuration
- Inherits:
-
Object
- Object
- PatternMatching::Configuration
- Defined in:
- lib/pattern_matching/configuration.rb
Overview
Available configuration options are:
-
use_proc_helpers: controls whether or not helpers for sending messages and calling a method in the local context are included with this module.
-
use_binding_helper: controls whether or not bindings are enabled (and thus) whether or not helpers are included.
-
send_helper: the method name used as the proc helper for “sending a message” to the object when matching.
-
call_helper: the method name used as the proc helper for “calling a method in the current context” with the object as an argument when matching.
-
binding_helper: the method name used as the binding set for each match.
Instance Attribute Summary collapse
-
#binding_helper ⇒ Object
Returns the value of attribute binding_helper.
-
#call_helper ⇒ Object
Returns the value of attribute call_helper.
-
#send_helper ⇒ Object
Returns the value of attribute send_helper.
-
#use_binding_helper ⇒ Object
Returns the value of attribute use_binding_helper.
-
#use_proc_helpers ⇒ Object
Returns the value of attribute use_proc_helpers.
Class Method Summary collapse
Instance Method Summary collapse
- #default_binding_helper? ⇒ Boolean
- #default_proc_helpers? ⇒ Boolean
-
#initialize(use_proc_helpers, use_binding_helper, send_helper, call_helper, binding_helper) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(use_proc_helpers, use_binding_helper, send_helper, call_helper, binding_helper) ⇒ Configuration
Returns a new instance of Configuration.
31 32 33 34 35 36 37 |
# File 'lib/pattern_matching/configuration.rb', line 31 def initialize(use_proc_helpers, use_binding_helper, send_helper, call_helper, binding_helper) @use_proc_helpers = use_proc_helpers @use_binding_helper = use_binding_helper @send_helper = send_helper @call_helper = call_helper @binding_helper = binding_helper end |
Instance Attribute Details
#binding_helper ⇒ Object
Returns the value of attribute binding_helper.
25 26 27 |
# File 'lib/pattern_matching/configuration.rb', line 25 def binding_helper @binding_helper end |
#call_helper ⇒ Object
Returns the value of attribute call_helper.
25 26 27 |
# File 'lib/pattern_matching/configuration.rb', line 25 def call_helper @call_helper end |
#send_helper ⇒ Object
Returns the value of attribute send_helper.
25 26 27 |
# File 'lib/pattern_matching/configuration.rb', line 25 def send_helper @send_helper end |
#use_binding_helper ⇒ Object
Returns the value of attribute use_binding_helper.
25 26 27 |
# File 'lib/pattern_matching/configuration.rb', line 25 def use_binding_helper @use_binding_helper end |
#use_proc_helpers ⇒ Object
Returns the value of attribute use_proc_helpers.
25 26 27 |
# File 'lib/pattern_matching/configuration.rb', line 25 def use_proc_helpers @use_proc_helpers end |
Class Method Details
.default ⇒ Object
21 22 23 |
# File 'lib/pattern_matching/configuration.rb', line 21 def self.default new(true, true, :S, :C, :B) end |
Instance Method Details
#default_binding_helper? ⇒ Boolean
45 46 47 |
# File 'lib/pattern_matching/configuration.rb', line 45 def default_binding_helper? :B == binding_helper end |
#default_proc_helpers? ⇒ Boolean
40 41 42 |
# File 'lib/pattern_matching/configuration.rb', line 40 def default_proc_helpers? :S == send_helper && :C == call_helper end |