Module: OnStomp::Failover::FailoverConfigurable::ClassMethods
- Defined in:
- lib/onstomp/failover/failover_configurable.rb
Overview
Provides attribute methods for failover clients.
Instance Method Summary (collapse)
-
- (Object) attr_configurable_bool(*args, &block)
Creates readable and writeable attributes that are automatically converted into boolean values.
-
- (Object) attr_configurable_buffer(nm)
Creates a readable and writeable attribute with the given name that defaults to the Buffers::Written.
-
- (Object) attr_configurable_pool(nm)
Creates a readable and writeable attribute with the given name that defaults to the Pools::RoundRobin.
Instance Method Details
- (Object) attr_configurable_bool(*args, &block)
Creates readable and writeable attributes that are automatically
converted into boolean values. Assigning the attributes any of
true
, 'true'
, '1'
or 1
will set the attribute to true
, all
other values with be treated as false
. This method will also alias
the reader methods with attr_name?
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/onstomp/failover/failover_configurable.rb', line 22 def attr_configurable_bool *args, &block trans = attr_configurable_wrap lambda { |v| [true, 'true', '1', 1].include?(v) }, block attr_configurable_single(*args, &trans) args.each do |a| unless a.is_a?(Hash) alias_method :#{a}?", a end end end |
- (Object) attr_configurable_buffer(nm)
Creates a readable and writeable attribute with the given name that defaults to the Buffers::Written. Corresponds the the class to use for frame buffering and de-buffering.
49 50 51 52 53 54 |
# File 'lib/onstomp/failover/failover_configurable.rb', line 49 def attr_configurable_buffer nm attr_configurable_class(nm, :default => OnStomp::Failover::Buffers::Written) do |b| b || OnStomp::Failover::Buffers::Written end end |
- (Object) attr_configurable_pool(nm)
Creates a readable and writeable attribute with the given name that defaults to the Pools::RoundRobin. Corresponds the the class to use when creating new client pools.
38 39 40 41 42 43 |
# File 'lib/onstomp/failover/failover_configurable.rb', line 38 def attr_configurable_pool nm attr_configurable_class(nm, :default => OnStomp::Failover::Pools::RoundRobin) do |p| p || OnStomp::Failover::Pools::RoundRobin end end |