class ExternalJSON::ExternalJSON_tag
Public Class Methods
new(tag_name, text, tokens)
click to toggle source
Calls superclass method
# File lib/externaljson.rb, line 7 def initialize(tag_name, text, tokens) super @text = text end
Public Instance Methods
render(context)
click to toggle source
# File lib/externaljson.rb, line 12 def render(context) if /(.+) from url (.+)/.match(@text) resp = Net::HTTP.get_response(URI($2.strip)) data = resp.body context[$1] = JSON data nil else # syntax error raise ArgumentError, 'ERROR:bad_syntax' end end