Class: MarcBot::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/marc_bot/factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFactory

Returns a new instance of Factory.



5
6
7
# File 'lib/marc_bot/factory.rb', line 5

def initialize
  @record = MARC::Record.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/marc_bot/factory.rb', line 9

def method_missing(method, *args, &block)
  if method == :leader
    record.leader = yield
  else
    record.append MarcBot::FieldBuilder.call(method: method, input: yield, args: args)
  end
end

Instance Attribute Details

#recordObject (readonly)

Returns the value of attribute record.



3
4
5
# File 'lib/marc_bot/factory.rb', line 3

def record
  @record
end

Instance Method Details

#respond_to_missing?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/marc_bot/factory.rb', line 17

def respond_to_missing?
  super
end