Class: VCardio::Builder
- Inherits:
-
Object
show all
- Defined in:
- lib/vcardio/builder.rb
Defined Under Namespace
Classes: PropertyBuilder
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
3
4
5
|
# File 'lib/vcardio/builder.rb', line 3
def initialize
@builders = []
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
7
8
9
10
11
12
|
# File 'lib/vcardio/builder.rb', line 7
def method_missing(method_name, *args)
return super if respond_to?(method_name)
builder = PropertyBuilder.new(method_name, args)
@builders << builder
builder
end
|
Class Method Details
.call(&block) ⇒ Object
24
25
26
27
28
|
# File 'lib/vcardio/builder.rb', line 24
def self.call(&block)
instance = new
instance.instance_eval(&block)
instance
end
|
Instance Method Details
#properties ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/vcardio/builder.rb', line 14
def properties
properties = []
@builders.each do |builder|
properties << builder.to_property
end
properties
end
|