Class: Rubyang::Server::Base
- Inherits:
-
Object
- Object
- Rubyang::Server::Base
- Defined in:
- lib/rubyang/server/base.rb
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rubyang/server/base.rb', line 11 def initialize @pid = Process.pid @sock_dir = "/tmp/rubyang/server" #@sock_file = "#{@sock_dir}/#{self.class.to_s}.#{@pid}.sock" @sock_file = "#{@sock_dir}/#{self.class.to_s}.sock" FileUtils.mkdir_p @sock_dir @db = Rubyang::Database.new @db.load_model Rubyang::Model::Parser.parse File.open( "#{File.dirname(__FILE__)}/../yang/rubyang.yang", 'r' ).read end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 |
# File 'lib/rubyang/server/base.rb', line 23 def run #DRb.start_service( "drbunix:#{@sock_file}", @db, safe_level: 1 ) DRb.start_service( "drbunix:#{@sock_file}", @db ) DRb.thread.join end |