Class: DistrictCn::Db::File
- Inherits:
-
Object
- Object
- DistrictCn::Db::File
- Defined in:
- lib/district_cn/db.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
-
#tree ⇒ Object
readonly
Returns the value of attribute tree.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ File
constructor
A new instance of File.
- #provinces ⇒ Object
Constructor Details
#initialize ⇒ File
Returns a new instance of File.
11 12 13 14 15 |
# File 'lib/district_cn/db.rb', line 11 def initialize @tree = {} @list = {} parse end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
5 6 7 |
# File 'lib/district_cn/db.rb', line 5 def list @list end |
#tree ⇒ Object (readonly)
Returns the value of attribute tree.
5 6 7 |
# File 'lib/district_cn/db.rb', line 5 def tree @tree end |
Class Method Details
.instance ⇒ Object
18 19 20 |
# File 'lib/district_cn/db.rb', line 18 def instance @instance ||= new end |
.list ⇒ Object
30 31 32 |
# File 'lib/district_cn/db.rb', line 30 def list instance.list end |
.provinces ⇒ Object
22 23 24 |
# File 'lib/district_cn/db.rb', line 22 def provinces instance.provinces end |
.tree ⇒ Object
26 27 28 |
# File 'lib/district_cn/db.rb', line 26 def tree instance.tree end |
Instance Method Details
#provinces ⇒ Object
7 8 9 |
# File 'lib/district_cn/db.rb', line 7 def provinces @provinces ||= @tree.map{|pvn_id,pvn_hash| [pvn_hash[:text],pvn_id]} end |