Class: Stupidedi::Config::TransactionSetConfig
- Inherits:
-
Object
- Object
- Stupidedi::Config::TransactionSetConfig
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/config/transaction_set_config.rb
Overview
The implementation version specified in GS08 and ST03 indicates which implementation guide governs the transaction. Because each guide may define multiple transaction sets (eg X212 and X279), the functional code and transaction set code are needed to lookup a definition.
In english, we can’t just look at ST01 and link “837” to our definition of 837P from the HIPAA guide.
Instance Method Summary collapse
- #at(version, function, transaction) ⇒ TransactionSetDef
- #customize(&block) ⇒ Object
- #defined_at?(version, function, transaction) ⇒ Boolean
-
#initialize ⇒ TransactionSetConfig
constructor
A new instance of TransactionSetConfig.
- #pretty_print(q) ⇒ void
- #register(version, function, transaction, definition = nil, &constructor) ⇒ void
Methods included from Inspect
Constructor Details
#initialize ⇒ TransactionSetConfig
Returns a new instance of TransactionSetConfig.
18 19 20 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 18 def initialize @table = Hash.new end |
Instance Method Details
#at(version, function, transaction) ⇒ TransactionSetDef
69 70 71 72 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 69 def at(version, function, transaction) x = @table[Array[version, nil, transaction]] x.is_a?(Proc) ? x.call : x end |
#customize(&block) ⇒ Object
22 23 24 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 22 def customize(&block) tap(&block) end |
#defined_at?(version, function, transaction) ⇒ Boolean
74 75 76 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 74 def defined_at?(version, function, transaction) @table.defined_at?([version, nil, transaction]) end |
#pretty_print(q) ⇒ void
This method returns an undefined value.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 79 def pretty_print(q) q.text "TransactionSetConfig" q.group(2, "(", ")") do q.breakable "" @table.keys.each do |e| unless q.current_group.first? q.text "," q.breakable end q.pp e end end end |
#register(version, function, transaction, definition = nil, &constructor) ⇒ void
This method returns an undefined value.
60 61 62 63 64 65 66 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 60 def register(version, function, transaction, definition = nil, &constructor) if block_given? @table[Array[version, nil, transaction]] = constructor else @table[Array[version, nil, transaction]] = definition end end |