Module: RubyNext::Core
- Defined in:
- lib/ruby-next/core.rb,
lib/ruby-next/core/string/strip.rb
Defined Under Namespace
Modules: StringStripSelectors
Classes: Patch, Patches
Constant Summary
collapse
- STRATEGIES =
%i[refine core_ext backports].freeze
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.strategy ⇒ Object
Returns the value of attribute strategy.
107
108
109
|
# File 'lib/ruby-next/core.rb', line 107
def strategy
@strategy
end
|
Class Method Details
.backports? ⇒ Boolean
122
123
124
|
# File 'lib/ruby-next/core.rb', line 122
def backports?
strategy == :backports
end
|
.core_ext? ⇒ Boolean
118
119
120
|
# File 'lib/ruby-next/core.rb', line 118
def core_ext?
strategy == :core_ext || strategy == :backports
end
|
.inject!(contents) ⇒ Object
Inject using RubyNext at the top of the source code
131
132
133
134
135
136
137
138
|
# File 'lib/ruby-next/core.rb', line 131
def inject!(contents)
if contents.frozen?
contents = contents.sub(/^(\s*[^#\s].*)/, 'using RubyNext;\1')
else
contents.sub!(/^(\s*[^#\s].*)/, 'using RubyNext;\1')
end
contents
end
|
.patch ⇒ Object
126
127
128
|
# File 'lib/ruby-next/core.rb', line 126
def patch(...)
patches << Patch.new(...)
end
|
.patches ⇒ Object
140
141
142
|
# File 'lib/ruby-next/core.rb', line 140
def patches
@patches ||= Patches.new
end
|
.refine? ⇒ Boolean
114
115
116
|
# File 'lib/ruby-next/core.rb', line 114
def refine?
strategy == :refine
end
|