Class: Zoom
- Inherits:
-
Object
show all
- Defined in:
- lib/zoom.rb
Defined Under Namespace
Classes: Cache, Config, Editor, Error, Profile, ProfileManager, SecurityProfile
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(cache = nil, rc = nil) ⇒ Zoom
Returns a new instance of Zoom.
88
89
90
91
92
|
# File 'lib/zoom.rb', line 88
def initialize(cache = nil, rc = nil)
@config = Zoom::Config.new(rc)
@cache = Zoom::Cache.new(@config, cache)
@@hilight = @config.hilight?
end
|
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache.
5
6
7
|
# File 'lib/zoom.rb', line 5
def cache
@cache
end
|
#config ⇒ Object
Returns the value of attribute config.
6
7
8
|
# File 'lib/zoom.rb', line 6
def config
@config
end
|
Class Method Details
.hilight(hilight = true) ⇒ Object
79
80
81
|
# File 'lib/zoom.rb', line 79
def self.hilight(hilight = true)
@@hilight = hilight
end
|
.hilight? ⇒ Boolean
83
84
85
86
|
# File 'lib/zoom.rb', line 83
def self.hilight?
@@hilight ||= false
return @@hilight
end
|
Instance Method Details
#open(results) ⇒ Object
94
95
96
97
|
# File 'lib/zoom.rb', line 94
def open(results)
return if (results.nil? || results.empty?)
Zoom::Editor.new(@config.get_editor).open(results)
end
|
#repeat(shortcut = true) ⇒ Object
99
100
101
102
|
# File 'lib/zoom.rb', line 99
def repeat(shortcut = true)
return if (@cache.empty?)
run(@cache., shortcut, true)
end
|
#run(h, shortcut = true, repeat = false) ⇒ Object
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/zoom.rb', line 104
def run(h, shortcut = true, repeat = false)
= h.clone
= () if (!repeat)
["pwd"] = Dir.pwd if (repeat)
profile_name = ["profile_name"]
profile = @config.get_profile(profile_name)
begin
@cache.clear
@cache.()
["translated"] = profile.translate(
["translate"]
).strip
= profile.preprocess()
@cache.write(profile.exe(), ["regex"])
@cache.shortcut if (shortcut)
rescue Interrupt
end
end
|