Class: Proc
Instance Method Summary collapse
Instance Method Details
#change? ⇒ Boolean
263 264 265 266 267 268 |
# File 'lib/bacon.rb', line 263 def change? pre_result = yield called = call post_result = yield pre_result != post_result end |
#raise?(*exceptions) ⇒ Boolean
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/bacon.rb', line 239 def raise?(*exceptions) exceptions = [RuntimeError] if exceptions.empty? call # Only to work in 1.9.0, rescue with splat doesn't work there right now rescue Object => e case e when *exceptions e else raise e end else false end |
#throw?(sym) ⇒ Boolean
255 256 257 258 259 260 261 |
# File 'lib/bacon.rb', line 255 def throw?(sym) catch(sym) { call return false } return true end |