Class: ESortCode::IndustrySortCodeDirectory
- Inherits:
-
Object
- Object
- ESortCode::IndustrySortCodeDirectory
- Defined in:
- lib/esortcode/industry_sort_code_directory.rb
Instance Method Summary collapse
-
#[](v) ⇒ Object
We cache the requested entries in a hash for quicker repeated access to.
-
#initialize(xml_doc) ⇒ IndustrySortCodeDirectory
constructor
A new instance of IndustrySortCodeDirectory.
Constructor Details
#initialize(xml_doc) ⇒ IndustrySortCodeDirectory
Returns a new instance of IndustrySortCodeDirectory.
3 4 5 6 |
# File 'lib/esortcode/industry_sort_code_directory.rb', line 3 def initialize(xml_doc) @xml = xml_doc @fields = Hash.new end |
Instance Method Details
#[](v) ⇒ Object
We cache the requested entries in a hash for quicker repeated access to
10 11 12 13 14 15 16 17 |
# File 'lib/esortcode/industry_sort_code_directory.rb', line 10 def [](v) unless @fields.has_key?(v) t = @xml.get_text("*/#{v}") @fields[v] = t && t.to_s end @fields[v] end |