Sha256: 23f162fa8ea9d24994fa118e68435f15a1ae72bdf3ab4683a01998767a306c86
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
Configliere.use :define module Configliere module Block # Config blocks to be executed at end of resolution (just before validation) attr_accessor :final_blocks def final_blocks @final_blocks ||= [] end # @param param the setting to describe. Either a simple symbol or a dotted param string. # @param definitions the defineables to set (:description, :type, :encrypted, etc.) # # @example # Settings.define :dest_time, :type => Date, :description => 'Arrival time. If only a date is given, the current time of day on that date is assumed.' # Settings.define 'delorean.power_source', :description => 'Delorean subsytem supplying power to the Flux Capacitor.' # Settings.define :password, :required => true, :obscure => true # def finally &block self.final_blocks << block end # calls superclass resolution def resolve! begin ; super() ; rescue NoMethodError ; nil ; end resolve_finally_blocks! self end protected def resolve_finally_blocks! final_blocks.each do |block| block.call(self) end end end Param.class_eval do include Configliere::Block end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
configliere-0.0.1 | lib/configliere/config_blocks.rb |