Class: Stupidedi::Config

Inherits:
Object
  • Object
show all
Includes:
Inspect
Defined in:
lib/stupidedi/config.rb,
lib/stupidedi/config/editor_config.rb,
lib/stupidedi/config/code_list_config.rb,
lib/stupidedi/config/interchange_config.rb,
lib/stupidedi/config/transaction_set_config.rb,
lib/stupidedi/config/functional_group_config.rb

Defined Under Namespace

Classes: CodeListConfig, EditorConfig, FunctionalGroupConfig, InterchangeConfig, TransactionSetConfig

Instance Attribute Summary collapse

Constructors collapse

Instance Method Summary collapse

Methods included from Inspect

#inspect

Constructor Details

#initializeConfig



30
31
32
33
34
35
36
# File 'lib/stupidedi/config.rb', line 30

def initialize
  @interchange      = InterchangeConfig.new
  @functional_group = FunctionalGroupConfig.new
  @transaction_set  = TransactionSetConfig.new
  @code_list        = CodeListConfig.new
  @editor           = EditorConfig.new
end

Instance Attribute Details

#code_listCodeListConfig (readonly)



25
26
27
# File 'lib/stupidedi/config.rb', line 25

def code_list
  @code_list
end

#editorEditorConfig (readonly)



28
29
30
# File 'lib/stupidedi/config.rb', line 28

def editor
  @editor
end

#functional_groupFunctionalGroupConfig (readonly)



19
20
21
# File 'lib/stupidedi/config.rb', line 19

def functional_group
  @functional_group
end

#interchangeInterchangeConfig (readonly)



16
17
18
# File 'lib/stupidedi/config.rb', line 16

def interchange
  @interchange
end

#transaction_setTransactionSetConfig (readonly)



22
23
24
# File 'lib/stupidedi/config.rb', line 22

def transaction_set
  @transaction_set
end

Class Method Details

.contrib(base = default)



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/stupidedi/config.rb', line 118

def contrib(base = default)
  base.customize do |c|
    c.transaction_set.customize do |x|
      x.register("004010", "PO", "850") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::PO850 }
      x.register("004010", "OW", "940") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::OW940 }
      x.register("004010", "AR", "943") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::AR943 }
      x.register("004010", "RE", "944") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::RE944 }
      x.register("004010", "SW", "945") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SW945 }
      x.register("004010", "SM", "204") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SM204 }
      x.register("004010", "QM", "214") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::QM214 }
      x.register("004010", "GF", "990") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::GF990 }
      x.register("004010", "SS", "862") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SS862 }
      x.register("004010", "PS", "830") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::PS830 }
      x.register("004010", "SH", "856") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SH856 }
      x.register("004010", "SQ", "866") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SQ866 }
      x.register("004010", "FA", "997") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::FA997 }
      x.register("004010", "SC", "832") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SC832 }

      x.register("002001", "SH", "856") { Stupidedi::Contrib::TwoThousandOne::TransactionSetDefs::SH856 }
      x.register("002001", "PO", "830") { Stupidedi::Contrib::TwoThousandOne::TransactionSetDefs::PO830 }
      x.register("002001", "FA", "997") { Stupidedi::Contrib::TwoThousandOne::TransactionSetDefs::FA997 }

      x.register("003010", "RA", "820") { Stupidedi::Contrib::ThirtyTen::TransactionSetDefs::RA820 }
      x.register("003010", "PO", "850") { Stupidedi::Contrib::ThirtyTen::TransactionSetDefs::PO850 }
      x.register("003010", "PC", "860") { Stupidedi::Contrib::ThirtyTen::TransactionSetDefs::PC860 }
      x.register("003010", "PS", "830") { Stupidedi::Contrib::ThirtyTen::TransactionSetDefs::PS830 }

      x.register("003040", "WA", "142") { Stupidedi::Contrib::ThirtyForty::TransactionSetDefs::WA142 }

      x.register("003050", "PO", "850") { Stupidedi::Contrib::ThirtyFifty::TransactionSetDefs::PO850 }
    end
  end
end

.defaultConfig



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/stupidedi/config.rb', line 74

def default
  new.customize do |c|
    c.interchange.customize do |x|
      #x.register("00200") { Stupidedi::Versions::Interchanges::FourOhOne::InterchangeDef }
      x.register("00200") { Stupidedi::Versions::Interchanges::TwoHundred::InterchangeDef }
      x.register("00300") { Stupidedi::Versions::Interchanges::ThreeHundred::InterchangeDef }
      x.register("00400") { Stupidedi::Versions::Interchanges::FourHundred::InterchangeDef }
      x.register("00401") { Stupidedi::Versions::Interchanges::FourOhOne::InterchangeDef }
      x.register("00501") { Stupidedi::Versions::Interchanges::FiveOhOne::InterchangeDef }
    end

    c.functional_group.customize do |x|
      # x.register("002001") { Stupidedi::Versions::FunctionalGroups::FortyTen::FunctionalGroupDef }
      x.register("002001") { Stupidedi::Versions::FunctionalGroups::TwoThousandOne::FunctionalGroupDef }
      x.register("003010") { Stupidedi::Versions::FunctionalGroups::ThirtyTen::FunctionalGroupDef }
      x.register("003040") { Stupidedi::Versions::FunctionalGroups::ThirtyForty::FunctionalGroupDef }
      x.register("003050") { Stupidedi::Versions::FunctionalGroups::ThirtyFifty::FunctionalGroupDef }
      x.register("004010") { Stupidedi::Versions::FunctionalGroups::FortyTen::FunctionalGroupDef }
      x.register("005010") { Stupidedi::Versions::FunctionalGroups::FiftyTen::FunctionalGroupDef }
    end
  end
end

.hipaa(base = default)



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/stupidedi/config.rb', line 97

def hipaa(base = default)
  base.customize do |c|
    c.transaction_set.customize do |x|
      x.register("004010", "HP", "835") { Stupidedi::Versions::FunctionalGroups::FortyTen::TransactionSetDefs::HP835 }
      x.register("005010", "HN", "277") { Stupidedi::Versions::FunctionalGroups::FiftyTen::TransactionSetDefs::HN277 }
      x.register("005010", "HP", "835") { Stupidedi::Versions::FunctionalGroups::FiftyTen::TransactionSetDefs::HP835 }
      x.register("005010", "HC", "837") { Stupidedi::Versions::FunctionalGroups::FiftyTen::TransactionSetDefs::HC837 }
      x.register("005010", "FA", "999") { Stupidedi::Versions::FunctionalGroups::FiftyTen::TransactionSetDefs::FA999 }

      x.register("004010X091A1", "HP", "835") { Stupidedi::Guides::FortyTen::X091A1::HP835 }
      x.register("005010X214",   "HN", "277") { Stupidedi::Guides::FiftyTen::X214::HN277  }
      x.register("005010X221",   "HP", "835") { Stupidedi::Guides::FiftyTen::X221::HP835  }
      x.register("005010X222",   "HC", "837") { Stupidedi::Guides::FiftyTen::X222::HC837P }
      x.register("005010X231",   "FA", "999") { Stupidedi::Guides::FiftyTen::X231::FA999  }
      x.register("005010X221A1", "HP", "835") { Stupidedi::Guides::FiftyTen::X221A1::HP835  }
      x.register("005010X222A1", "HC", "837") { Stupidedi::Guides::FiftyTen::X222A1::HC837P }
      x.register("005010X231A1", "FA", "999") { Stupidedi::Guides::FiftyTen::X231A1::FA999  }
    end
  end
end

Instance Method Details

#customize(&block)



38
39
40
# File 'lib/stupidedi/config.rb', line 38

def customize(&block)
  tap(&block)
end

#pretty_print(q)



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/stupidedi/config.rb', line 43

def pretty_print(q)
  q.text "Config"
  q.group 2, "(", ")" do
    q.breakable ""

    q.pp @interchange
    q.text ","
    q.breakable

    q.pp @functional_group
    q.text ","
    q.breakable

    q.pp @transaction_set
    q.text ","
    q.breakable

    q.pp @code_list
    q.text ","
    q.breakable

    q.pp @editor
  end
end