Class: TCB::DomainContext
- Inherits:
-
Object
- Object
- TCB::DomainContext
- Defined in:
- lib/tcb/domain_context.rb
Constant Summary collapse
- NAMESPACE_SEPARATOR =
"/"- TABLE_SEPARATOR =
"__"- TABLE_SUFFIX =
"_events"- OUTBOX_SUFFIX =
"_outbox"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_module(domain_module) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/tcb/domain_context.rb', line 11 def self.from_module(domain_module) value = domain_module.name .gsub("::", NAMESPACE_SEPARATOR) .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .downcase new(value: value) end |
Instance Method Details
#outbox_table_name ⇒ Object
31 32 33 34 35 |
# File 'lib/tcb/domain_context.rb', line 31 def outbox_table_name value .gsub(NAMESPACE_SEPARATOR, TABLE_SEPARATOR) .concat(OUTBOX_SUFFIX) end |
#table_name ⇒ Object
25 26 27 28 29 |
# File 'lib/tcb/domain_context.rb', line 25 def table_name value .gsub(NAMESPACE_SEPARATOR, TABLE_SEPARATOR) .concat(TABLE_SUFFIX) end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/tcb/domain_context.rb', line 21 def to_s value end |