Class: MarcBot::Factory
- Inherits:
-
Object
- Object
- MarcBot::Factory
- Defined in:
- lib/marc_bot/factory.rb
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize ⇒ Factory
constructor
A new instance of Factory.
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to_missing? ⇒ Boolean
Constructor Details
#initialize ⇒ Factory
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
#record ⇒ Object (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
17 18 19 |
# File 'lib/marc_bot/factory.rb', line 17 def respond_to_missing? super end |