Class: Vedeu::API::View
- Inherits:
-
Object
show all
- Defined in:
- lib/vedeu/api/view.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name) ⇒ View
Returns a new instance of View.
10
11
12
13
14
|
# File 'lib/vedeu/api/view.rb', line 10
def initialize(name)
fail InterfaceNotSpecified if name.nil? || name.empty?
@name = name.to_s
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
40
41
42
|
# File 'lib/vedeu/api/view.rb', line 40
def method_missing(method, *args, &block)
@self_before_instance_eval.send method, *args, &block
end
|
Class Method Details
.build(name, &block) ⇒ Object
6
7
8
|
# File 'lib/vedeu/api/view.rb', line 6
def self.build(name, &block)
new(name).build(&block)
end
|
Instance Method Details
#attributes ⇒ Object
30
31
32
|
# File 'lib/vedeu/api/view.rb', line 30
def attributes
@_attributes ||= { name: name, lines: [] }
end
|
#build(&block) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/vedeu/api/view.rb', line 16
def build(&block)
if block_given?
@self_before_instance_eval = eval('self', block.binding)
instance_eval(&block)
end
attributes
end
|
#line(&block) ⇒ Object
26
27
28
|
# File 'lib/vedeu/api/view.rb', line 26
def line(&block)
attributes[:lines] << Line.build(&block)
end
|
#name ⇒ Object
34
35
36
|
# File 'lib/vedeu/api/view.rb', line 34
def name
return @name if Store.query(@name)
end
|