Class: Rys::PatcherDSL
- Inherits:
-
Object
- Object
- Rys::PatcherDSL
- Defined in:
- lib/rys/patcher.rb
Instance Method Summary collapse
- #_result ⇒ Object
- #apply_if(value = nil, &block) ⇒ Object
- #apply_only_once! ⇒ Object
- #before ⇒ Object
- #class_methods(**options, &block) ⇒ Object
- #included(&block) ⇒ Object (also: #includeds)
-
#initialize ⇒ PatcherDSL
constructor
A new instance of PatcherDSL.
- #instance_methods(**options, &block) ⇒ Object
- #name ⇒ Object
- #where(place) ⇒ Object
Constructor Details
#initialize ⇒ PatcherDSL
97 98 99 100 101 102 103 104 |
# File 'lib/rys/patcher.rb', line 97 def initialize @_where = nil @_apply_if = nil @_apply_only_once = false @_includeds = [] @_instance_methods = [] @_class_methods = [] end |
Instance Method Details
#_result ⇒ Object
106 107 108 109 110 111 112 113 114 115 |
# File 'lib/rys/patcher.rb', line 106 def _result { where: @_where, apply_if: @_apply_if, apply_only_once: @_apply_only_once, includeds: @_includeds, instance_methods: @_instance_methods, class_methods: @_class_methods, } end |
#apply_if(value = nil, &block) ⇒ Object
129 130 131 132 133 134 135 136 137 |
# File 'lib/rys/patcher.rb', line 129 def apply_if(value=nil, &block) if block_given? @_apply_if = block elsif value.is_a?(Proc) @_apply_if = value else raise '`apply_if` require Proc or block' end end |
#apply_only_once! ⇒ Object
139 140 141 |
# File 'lib/rys/patcher.rb', line 139 def apply_only_once! @_apply_only_once = true end |
#before ⇒ Object
121 122 123 |
# File 'lib/rys/patcher.rb', line 121 def before # Comming soon end |
#class_methods(**options, &block) ⇒ Object
151 152 153 |
# File 'lib/rys/patcher.rb', line 151 def class_methods(**, &block) @_class_methods << [, block] end |
#included(&block) ⇒ Object Also known as: includeds
143 144 145 |
# File 'lib/rys/patcher.rb', line 143 def included(&block) @_includeds << block end |
#instance_methods(**options, &block) ⇒ Object
147 148 149 |
# File 'lib/rys/patcher.rb', line 147 def instance_methods(**, &block) @_instance_methods << [, block] end |
#name ⇒ Object
117 118 119 |
# File 'lib/rys/patcher.rb', line 117 def name # Comming soon end |
#where(place) ⇒ Object
125 126 127 |
# File 'lib/rys/patcher.rb', line 125 def where(place) @_where = place end |