Class: WhatIs::ThisIs::NotFound
- Inherits:
- 
      Object
      
        - Object
- WhatIs::ThisIs::NotFound
 
- Defined in:
- lib/whatis/thisis/notfound.rb
Overview
Represents not found page, allowing to search for term through Wikipedia API.
You should never create instances of this class directly, but rather obtain it from WhatIs#this and WhatIs#these.
Instance Attribute Summary collapse
- #title ⇒ String readonly
Instance Method Summary collapse
- #describe(help: true) ⇒ Description
- 
  
    
      #initialize(owner, title)  ⇒ NotFound 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of NotFound. 
- #inspect ⇒ String
- 
  
    
      #search(limit = 5, **options)  ⇒ Array<ThisIs, ThisIs::Ambigous> 
    
    
  
  
  
  
  
  
  
  
  
    Searches for requested entity name through Wikipedia API. 
- #to_h ⇒ Hash
- #to_json(opts) ⇒ String
- #to_s ⇒ String
Constructor Details
#initialize(owner, title) ⇒ NotFound
Returns a new instance of NotFound.
| 19 20 21 22 | # File 'lib/whatis/thisis/notfound.rb', line 19 def initialize(owner, title) @owner = owner @title = title end | 
Instance Attribute Details
#title ⇒ String (readonly)
| 16 17 18 | # File 'lib/whatis/thisis/notfound.rb', line 16 def title @title end | 
Instance Method Details
#describe(help: true) ⇒ Description
| 58 59 60 | # File 'lib/whatis/thisis/notfound.rb', line 58 def describe(help: true) Description.new("#{self}#{describe_help(help)}") end | 
#inspect ⇒ String
| 38 39 40 | # File 'lib/whatis/thisis/notfound.rb', line 38 def inspect "#<ThisIs::NotFound #{title}>" end | 
#search(limit = 5, **options) ⇒ Array<ThisIs, ThisIs::Ambigous>
Searches for requested entity name through Wikipedia API.
See WhatIs#this for options explanation.
| 33 34 35 | # File 'lib/whatis/thisis/notfound.rb', line 33 def search(limit = 5, **) @owner.search(title, limit, **) end | 
#to_h ⇒ Hash
| 48 49 50 | # File 'lib/whatis/thisis/notfound.rb', line 48 def to_h {type: 'ThisIs::NotFound', title: title} end | 
#to_json(opts) ⇒ String
| 53 54 55 | # File 'lib/whatis/thisis/notfound.rb', line 53 def to_json(opts) to_h.to_json(opts) end | 
#to_s ⇒ String
| 43 44 45 | # File 'lib/whatis/thisis/notfound.rb', line 43 def to_s "#{title}: not found" end |