Class: Fixjour::Builder

Inherits:
Object show all
Defined in:
lib/fixjour/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, options = {}) ⇒ Builder

Returns a new instance of Builder.



5
6
7
# File 'lib/fixjour/builder.rb', line 5

def initialize(klass, options={})
  @klass, @options = klass, options
end

Instance Attribute Details

#klassObject (readonly)

Returns the value of attribute klass.



3
4
5
# File 'lib/fixjour/builder.rb', line 3

def klass
  @klass
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/fixjour/builder.rb', line 13

def eql?(other)
  @klass == other.klass
end

#hashObject



17
18
19
# File 'lib/fixjour/builder.rb', line 17

def hash
  @klass.hash
end

#nameObject



9
10
11
# File 'lib/fixjour/builder.rb', line 9

def name
  @name ||= (@options[:as] || @klass.name.underscore).to_s.gsub(/\W+/, '_')
end