Class: WolframAlpha::Subpod
- Inherits:
-
Object
- Object
- WolframAlpha::Subpod
- Defined in:
- library/wolfram-alpha/subpod.rb
Instance Method Summary collapse
-
#initialize(parent, element) ⇒ Subpod
constructor
Construct a new pod with an assigned element.
-
#inspect ⇒ Object
Inspect the subpod.
-
#plaintext ⇒ String
Returns the plaintext element as text.
-
#plaintext? ⇒ Boolean
Returns whether the subpod contains a plaintext element.
Constructor Details
#initialize(parent, element) ⇒ Subpod
Construct a new pod with an assigned element.
6 7 8 9 |
# File 'library/wolfram-alpha/subpod.rb', line 6 def initialize parent, element @parent = parent @element = element end |
Instance Method Details
#inspect ⇒ Object
Inspect the subpod.
24 25 26 |
# File 'library/wolfram-alpha/subpod.rb', line 24 def inspect %{#<#{self.class.name} plaintext: #{plaintext.inspect}>} end |
#plaintext ⇒ String
Returns the plaintext element as text.
19 20 21 |
# File 'library/wolfram-alpha/subpod.rb', line 19 def plaintext @plaintext ||= @element.at_css("plaintext").text end |
#plaintext? ⇒ Boolean
Returns whether the subpod contains a plaintext element.
12 13 14 |
# File 'library/wolfram-alpha/subpod.rb', line 12 def plaintext? not plaintext.nil? end |