Class: WRI::RiService

Inherits:
Object
  • Object
show all
Defined in:
lib/wri/ri_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(library = nil) ⇒ RiService

Returns a new instance of RiService.



9
10
11
# File 'lib/wri/ri_service.rb', line 9

def initialize(library=nil)
  @library = library
end

Instance Attribute Details

#libraryObject (readonly)

Returns the value of attribute library.



7
8
9
# File 'lib/wri/ri_service.rb', line 7

def library
  @library
end

Instance Method Details

#info(keyword) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/wri/ri_service.rb', line 13

def info(keyword)
  if library
    `ri -d #{library} -f html #{keyword}`
  else
    `ri -f html #{keyword}`
  end
end

#namesObject



21
22
23
24
25
26
27
# File 'lib/wri/ri_service.rb', line 21

def names
  @names ||= if library
    `ri -d #{library} --list-names`
  else
    `ri --list-names`
  end.split(/\s*\n/)
end