Class: Playpen

Inherits:
Object
  • Object
show all
Defined in:
lib/playpen.rb,
ext/playpen/playpen.c

Constant Summary collapse

VERSION =
'1.0.0'
SANDBOX_NAMED =
INT2NUM(SANDBOX_NAMED)
NO_INTERNET =
rb_str_new2(kSBXProfileNoInternet)
NO_NETWORK =
rb_str_new2(kSBXProfileNoNetwork)
NO_WRITE =
rb_str_new2(kSBXProfileNoWrite)
TEMP_ONLY_WRITE =
rb_str_new2(kSBXProfileNoWriteExceptTemporary)
COMPUTATION_ONLY =
rb_str_new2(kSBXProfilePureComputation)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlaypen

Returns a new instance of Playpen.



6
7
8
# File 'lib/playpen.rb', line 6

def initialize
  @commands = []
end

Class Method Details

.sandbox_init(name, flags) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'ext/playpen/playpen.c', line 4

static VALUE playpen_init(VALUE self, VALUE name, VALUE flags)
{
  char * error;
  if(sandbox_init(StringValuePtr(name), NUM2INT(flags), &error) < 0) {
    rb_raise(rb_eRuntimeError, "%s", error);
  }

  return self;
}

Instance Method Details

#apply!Object



10
11
12
13
14
# File 'lib/playpen.rb', line 10

def apply!
  @commands.each do |command|
    self.class.sandbox_init(command, Playpen::SANDBOX_NAMED)
  end
end