Class: 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.
19 20 21 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 19 def initialize @table = Hash.new end |
Instance Method Details
#at(version, function, transaction) ⇒ TransactionSetDef
70 71 72 73 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 70 def at(version, function, transaction) x = @table[Array[version, nil, transaction]] x.is_a?(Proc) ? x.call : x end |
#customize(&block) ⇒ Object
23 24 25 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 23 def customize(&block) tap(&block) end |
#defined_at?(version, function, transaction) ⇒ Boolean
75 76 77 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 75 def defined_at?(version, function, transaction) @table.defined_at?([version, nil, transaction]) end |
#pretty_print(q) ⇒ void
This method returns an undefined value.
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 80 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.
61 62 63 64 65 66 67 |
# File 'lib/stupidedi/config/transaction_set_config.rb', line 61 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 |