Class: FixerUpper
- Inherits:
-
Object
show all
- Defined in:
- lib/fixer_upper.rb,
lib/fixer_upper/error.rb,
lib/fixer_upper/version.rb,
lib/fixer_upper/renovation.rb
Defined Under Namespace
Classes: Error, Renovation
Constant Summary
collapse
- VERSION =
"0.3.0".freeze
Instance Method Summary
collapse
-
#diy(text, *engines, **options) ⇒ Object
-
#diy!(text, *engines, **options) ⇒ Object
-
#for(key) ⇒ Object
-
#initialize ⇒ FixerUpper
constructor
A new instance of FixerUpper.
-
#register(*keys, to:, **options) ⇒ Object
-
#renovate(filepath, contents = nil, **options) ⇒ Object
-
#renovate!(filepath, contents = nil, **options) ⇒ Object
Constructor Details
Returns a new instance of FixerUpper.
6
7
8
9
10
|
# File 'lib/fixer_upper.rb', line 6
def initialize
@engine_registry = {}
@options_registry = {}
@renovation = Renovation.new(@engine_registry, @options_registry)
end
|
Instance Method Details
#diy(text, *engines, **options) ⇒ Object
41
42
43
|
# File 'lib/fixer_upper.rb', line 41
def diy(text, *engines, **options)
@renovation.diy(text: text, engines: engines, options: options, bang: false)
end
|
#diy!(text, *engines, **options) ⇒ Object
45
46
47
|
# File 'lib/fixer_upper.rb', line 45
def diy!(text, *engines, **options)
@renovation.diy(text: text, engines: engines, options: options, bang: true)
end
|
#for(key) ⇒ Object
19
20
21
|
# File 'lib/fixer_upper.rb', line 19
def for(key)
@engine_registry[key]
end
|
#register(*keys, to:, **options) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/fixer_upper.rb', line 12
def register(*keys, to:, **options)
keys.each do |key|
@engine_registry[key] = to
@options_registry[key] = options
end
end
|
#renovate(filepath, contents = nil, **options) ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/fixer_upper.rb', line 23
def renovate(filepath, contents = nil, **options)
@renovation.renovate(
filepath: filepath,
text: contents,
options: options,
bang: false
)
end
|
#renovate!(filepath, contents = nil, **options) ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/fixer_upper.rb', line 32
def renovate!(filepath, contents = nil, **options)
@renovation.renovate(
filepath: filepath,
text: contents,
options: options,
bang: true
)
end
|