Class: RabbitMQSpec::DSL::Builder::Base::HashBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rabbitmq-spec/dsl/builder/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Helper class to evaluate blocks that are passe to the defined attributes for the inhereted classes

Instance Method Summary collapse

Constructor Details

#initializeHashBuilder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of HashBuilder.



82
83
84
# File 'lib/rabbitmq-spec/dsl/builder/base.rb', line 82

def initialize
  @hash = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



90
91
92
93
94
95
96
97
98
# File 'lib/rabbitmq-spec/dsl/builder/base.rb', line 90

def method_missing(method_name, *args, &block)
  @hash[method_name.to_sym] = if block_given?
                                builder = HashBuilder.new
                                builder.instance_eval(&block)
                                builder.build
                              else
                                args[0]
  end
end

Instance Method Details

#buildvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



86
87
88
# File 'lib/rabbitmq-spec/dsl/builder/base.rb', line 86

def build
  @hash
end