Class: Sphere::Backends::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/sphere/backends/base.rb

Direct Known Subclasses

Closure, YUI

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Base

Returns a new instance of Base.



21
22
23
# File 'lib/sphere/backends/base.rb', line 21

def initialize(content)
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



19
20
21
# File 'lib/sphere/backends/base.rb', line 19

def content
  @content
end

Class Method Details

.default_optionsObject



9
10
11
# File 'lib/sphere/backends/base.rb', line 9

def default_options
  {}
end

.uriObject



13
14
15
# File 'lib/sphere/backends/base.rb', line 13

def uri
  raise "Abstract Method"
end

Instance Method Details

#compressed(options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/sphere/backends/base.rb', line 25

def compressed(options = {})
  params   = create_params!(self.class.default_options.merge(options))
  response = Net::HTTP.post_form self.class.uri, params
  unless response.code == '200'
    STDERR.puts "ERROR during compilation. Response:"
    STDERR.puts response.body
    raise "Aborting!"
  end
  response.body
end