Class: ImportExport::Source
- Inherits:
-
Object
- Object
- ImportExport::Source
- Defined in:
- lib/import_export/source.rb
Constant Summary collapse
- SOURCES =
{ "DPL" => "Denied Persons List", "EL" => "Entity List", "FSE" => "Foreign Sanctions Evaders", "DTC" => "ITAR Debarred", "ISA" => "Non-SDN Iranian Sanctions Act List", "ISN" => "Nonproliferation Sanctions", "PLC" => "Palestinian Legislative Council List", "561" => "Part 561 List", "SSI" => "Sectoral Sanctions Identifications List", "SDN" => "Specially Designated Nationals", "UVL" => "Unverified List" }
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key) ⇒ Source
constructor
A new instance of Source.
- #inspect ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(key) ⇒ Source
Returns a new instance of Source.
39 40 41 |
# File 'lib/import_export/source.rb', line 39 def initialize(key) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
37 38 39 |
# File 'lib/import_export/source.rb', line 37 def key @key end |
Class Method Details
.all ⇒ Object
19 20 21 |
# File 'lib/import_export/source.rb', line 19 def all @all ||= SOURCES.map { |key, value| self.new(key) } end |
.find_by_key(key) ⇒ Object Also known as: []
23 24 25 |
# File 'lib/import_export/source.rb', line 23 def find_by_key(key) all.find { |source| source.key == key } end |
.find_by_name(name) ⇒ Object
28 29 30 |
# File 'lib/import_export/source.rb', line 28 def find_by_name(name) all.find { |source| source.name == name } end |
.keys ⇒ Object
32 33 34 |
# File 'lib/import_export/source.rb', line 32 def keys @keys ||= SOURCES.keys end |
Instance Method Details
#inspect ⇒ Object
43 44 45 |
# File 'lib/import_export/source.rb', line 43 def inspect "#<ImportExport::Source key=\"#{key}\" name=\"#{name}\">" end |
#name ⇒ Object
47 48 49 |
# File 'lib/import_export/source.rb', line 47 def name SOURCES[key] end |