lib/eddy/util/edi_data.rb in eddy-0.6.0 vs lib/eddy/util/edi_data.rb in eddy-0.7.0

- old
+ new

@@ -1,10 +1,10 @@ module Eddy module Util # @!group EDI Data - # Return raw data from `data/004010/elements.tsv`. + # Return raw data from `data/elements.tsv`. # # # @example Example return value # [ # {:id=>"1", :name=>"Route Code", :type=>"AN", :min=>"1", :max=>"13", :description=>"Mutually defined route code"}, @@ -13,11 +13,11 @@ # ..., # ] # # @return [Array<Hash>] def self.raw_element_data() - return Eddy::Util.parse_tsv(File.join(Eddy::Util.data_dir, "004010", "elements.tsv")) + return Eddy::Util.parse_tsv(File.join(Eddy::Util.data_dir, "elements.tsv")) end # Returns a hash where the keys are Element ids and the values are unprocessed Element names. # # @example Example return value @@ -34,11 +34,11 @@ # ..., # } # # @return [Hash<String, String>] def self.element_ids() - file = File.join(Eddy::Util.data_dir, "004010", "elements-short.tsv") + file = File.join(Eddy::Util.data_dir, "elements-short.tsv") data = {} CSV.foreach(file, { col_sep: "\t", quote_char: "\x00", headers: false }) do |row| next if row == ["id", "name"] data[row[0]] = row[1] end @@ -59,11 +59,11 @@ # ..., # } # # @return [Hash<String, String>] def self.segment_ids() - file = File.join(Eddy::Util.data_dir, "004010", "segments.tsv") + file = File.join(Eddy::Util.data_dir, "segments.tsv") data = {} CSV.foreach(file, { col_sep: "\t", quote_char: "\x00" }) do |row| next if row == ["id", "name"] data[row[0]] = row[1] end @@ -118,21 +118,21 @@ dir = File.join(Eddy::Util.root_dir, "lib", "definitions", "segments", "**", "*.rb") files = Dir.glob(dir) return files.map { |f| File.basename(f).sub(/\..*/, "").upcase } end - # List Segment definition files in `data/004010/segments`. + # List Segment definition files in `data/segments`. # # @example Example return value # [ - # "~/.rbenv/versions/2.6.5/lib/gems/eddy-0.0.0/data/004010/segments/ack.segment.yml", - # "~/.rbenv/versions/2.6.5/lib/gems/eddy-0.0.0/data/004010/segments/bak.segment.yml", + # "~/.rbenv/versions/2.6.5/lib/gems/eddy-0.0.0/data/segments/ack.segment.yml", + # "~/.rbenv/versions/2.6.5/lib/gems/eddy-0.0.0/data/segments/bak.segment.yml", # ..., # ] # # @return [Array<String>] def self.list_segment_definitions() - dir = File.join(Eddy::Util.data_dir, "004010", "segments") + dir = File.join(Eddy::Util.data_dir, "segments") files = Dir.entries(dir).select { |f| File.file?(File.join(dir, f)) } return files.map { |f| File.join(dir, f) }.sort end # List names of Elements with Ruby files currently in `Eddy.config.build_dir/elements`.