Module: CasualAPI::BodyWriter

Defined in:
lib/body_writer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(obj) ⇒ Object



4
5
6
# File 'lib/body_writer.rb', line 4

def self.extended obj
  obj.instance_variable_set(:@body, "")
end

Instance Method Details

#bodyObject



22
23
24
# File 'lib/body_writer.rb', line 22

def body
  @body
end

#body=(value) ⇒ Object



25
26
27
# File 'lib/body_writer.rb', line 25

def body=(value)
  @body = value
end

#command(cmd) ⇒ Object



19
20
21
# File 'lib/body_writer.rb', line 19

def command cmd
  write `#{cmd.to_s}`
end


10
11
12
# File 'lib/body_writer.rb', line 10

def print str
  @body << str.to_s
end

#printf(*p) ⇒ Object



16
17
18
# File 'lib/body_writer.rb', line 16

def printf *p
  @body << sprintf(*p)
end

#puts(str) ⇒ Object



13
14
15
# File 'lib/body_writer.rb', line 13

def puts str
  @body << str.to_s << "\n"
end

#write(str) ⇒ Object



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

def write str
  @body << str.to_s
end