Class: Calil::System
- Inherits:
-
Object
show all
- Defined in:
- lib/calil/system.rb
Instance Method Summary
collapse
Constructor Details
#initialize(element) ⇒ System
Returns a new instance of System.
4
5
6
|
# File 'lib/calil/system.rb', line 4
def initialize(element)
@element = element
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(action, *args) ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/calil/system.rb', line 16
def method_missing(action, *args)
if %w(status reserveurl).include? action.to_s
@element.elements[action.to_s].text
else
super
end
end
|
Instance Method Details
#inspect ⇒ Object
26
27
28
29
30
31
|
# File 'lib/calil/system.rb', line 26
def inspect
attr_body = %w(systemid status reserveurl reservable?).map do |method_name|
eval("\"#{method_name}: '#{send(method_name)}'\"")
end.join(", ")
"#<System #{attr_body}>"
end
|
#reservable? ⇒ Boolean
12
13
14
|
# File 'lib/calil/system.rb', line 12
def reservable?
!!(@element.elements["reserveurl"] && !@element.elements["reserveurl"].text.to_s.empty?)
end
|
#systemid ⇒ Object
8
9
10
|
# File 'lib/calil/system.rb', line 8
def systemid
@element.attributes["systemid"]
end
|