Class: Rubernate::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/rubernate/init.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInit

Returns a new instance of Init.



15
16
17
18
19
20
# File 'lib/rubernate/init.rb', line 15

def initialize
  self.hibernate_classes = []
              
  bytecode_provider
  
end

Instance Attribute Details

#bytecodeObject

Returns the value of attribute bytecode.



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

def bytecode
  @bytecode
end

#connectionObject

Returns the value of attribute connection.



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

def connection
  @connection
end

#hibernate_classesObject

Returns the value of attribute hibernate_classes.



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

def hibernate_classes
  @hibernate_classes
end

#parserObject

Returns the value of attribute parser.



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

def parser
  @parser
end

Instance Method Details

#bytecode_providerObject



36
37
38
39
# File 'lib/rubernate/init.rb', line 36

def bytecode_provider
  self.bytecode ||= Bytecode.new
  self.bytecode
end

#connect(connection) ⇒ Object



31
32
33
34
# File 'lib/rubernate/init.rb', line 31

def connect(connection)      
  self.connection= Connection.new(connection, self.hibernate_classes)
  self.connection.entity_manager_factory
end

#load_classes(*classes) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/rubernate/init.rb', line 23

def load_classes(*classes)
  classes.each do |clazz|
    self.hibernate_classes << ClassParser.new(clazz,self.bytecode).to_class
  end
  
  
end