class ActiveScaffold::Bridges::Bridge
Attributes
name[RW]
Public Class Methods
new(name, &block)
click to toggle source
# File lib/active_scaffold/bridges/bridge.rb, line 13 def initialize(name, &block) self.name = name @install = nil # by convention and default, use the bridge name as the required constant for installation @install_if = lambda { Object.const_defined?(name) } self.instance_eval(&block) ActiveScaffold::Bridges::Bridge.bridges << self end
run_all()
click to toggle source
# File lib/active_scaffold/bridges/bridge.rb, line 39 def self.run_all return false if self.bridges_run ActiveScaffold::Bridges::Bridge.bridges.each{|bridge| bridge.run } self.bridges_run=true end
Public Instance Methods
install(&block)
click to toggle source
Set the install block
# File lib/active_scaffold/bridges/bridge.rb, line 24 def install(&block) @install = block end
install?(&block)
click to toggle source
Set the install_if block (to check to see whether or not to install the block)
# File lib/active_scaffold/bridges/bridge.rb, line 29 def install?(&block) @install_if = block end
run()
click to toggle source
# File lib/active_scaffold/bridges/bridge.rb, line 34 def run raise(ArgumentError, "install and install? not defined for bridge #{name}" ) unless @install && @install_if @install.call if @install_if.call end