Class: NetSystem::Database
- Inherits:
-
Liza::Controller
- Object
- Liza::Unit
- Liza::Controller
- NetSystem::Database
- Defined in:
- lib/net_system/subsystems/database/database.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Attributes inherited from Liza::Controller
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(client: get(:client).new) ⇒ Database
constructor
A new instance of Database.
Methods inherited from Liza::Controller
`, #`, attr_accessor, attr_reader, attr_writer, #attrs, #box, box, color, division, division!, division?, menv_accessor, menv_reader, menv_writer, on_connected, panel, #panel, plural, require, requirements, #sh, sh, singular, subsystem, subsystem!, subsystem?, subsystem_token, token
Methods inherited from Liza::Unit
_erbs_for, #add, add, cl, #cl, class_methods_defined, const_added, const_missing, constants_defined, define_error, descendants_select, division, erbs_available, erbs_defined, erbs_for, errors, #fetch, fetch, get, #get, instance_methods_defined, log, #log, log?, #log?, #log_array, log_array, log_hash, #log_hash, #log_level, log_level, #log_level?, log_level?, log_levels, #log_levels, #log_render_convert, #log_render_format, #log_render_in, #log_render_out, method_added, methods_defined, namespace, part, raise_error, #raise_error, reload!, #reload!, #render, #render!, #render_stack, renderable_formats_for, renderable_names, section, sections, #set, set, #settings, settings, singleton_method_added, sleep, #sleep, stick, #stick, sticks, #sticks, subclasses_select, subunits, system, #system, system?, test_class, time_diff, #time_diff
Constructor Details
#initialize(client: get(:client).new) ⇒ Database
Returns a new instance of Database.
13 14 15 |
# File 'lib/net_system/subsystems/database/database.rb', line 13 def initialize client: get(:client).new @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
11 12 13 |
# File 'lib/net_system/subsystems/database/database.rb', line 11 def client @client end |
Class Method Details
.call ⇒ Object
28 |
# File 'lib/net_system/subsystems/database/database.rb', line 28 def self.call(...); current.call(...); end |
.current ⇒ Object
21 22 23 24 25 26 |
# File 'lib/net_system/subsystems/database/database.rb', line 21 def self.current Thread.current[last_namespace] ||= begin log "Connecting to #{last_namespace}" new end end |
.inherited(sub) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/net_system/subsystems/database/database.rb', line 3 def self.inherited sub super return if sub.name.nil? return if sub.name.end_with? "Db" raise "please rename #{sub.name} to #{sub.name}Db" end |
Instance Method Details
#call ⇒ Object
29 |
# File 'lib/net_system/subsystems/database/database.rb', line 29 def call(...); @client.call(...); end |