Module: RoboEd
- Defined in:
- lib/robo_ed.rb,
lib/robo_ed/version.rb
Constant Summary collapse
- ENDPOINT =
'http://www.ed.conpet.gov.br/mod_perl/bot_gateway.cgi?server=0.0.0.0%3A8085&charset_post=utf-8&charset=utf-8&pure=1&js=0&tst=1&msg='- TRUE_VALUES =
[true, 1, '1', 't', 'T', 'true', 'TRUE']
- VERSION =
'1.1.2'false
Class Method Summary collapse
- .ask(question) ⇒ Object
- .setup {|_self| ... } ⇒ Object
- .strip_tags ⇒ Object
- .strip_tags=(option) ⇒ Object
Class Method Details
.ask(question) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/robo_ed.rb', line 22 def self.ask question question = question.to_s raise 'Question cannot be blank!' if question.empty? request = open(ENDPOINT + URI.encode(question)) answer = request.read.strip answer = answer.gsub(/<[^>]*>/, '') if self. return answer end |
.setup {|_self| ... } ⇒ Object
18 19 20 |
# File 'lib/robo_ed.rb', line 18 def self.setup(&block) yield self end |
.strip_tags ⇒ Object
10 11 12 |
# File 'lib/robo_ed.rb', line 10 def self. end |
.strip_tags=(option) ⇒ Object
14 15 16 |
# File 'lib/robo_ed.rb', line 14 def self.= option = TRUE_VALUES.include?(option) end |