Class: DbSpiderNodeSet
- Inherits:
-
Object
- Object
- DbSpiderNodeSet
- Defined in:
- lib/db_facet/db_spider_node_set.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#uniq_count ⇒ Object
readonly
Returns the value of attribute uniq_count.
Instance Method Summary collapse
- #find_or_create(*args) ⇒ Object
-
#initialize ⇒ DbSpiderNodeSet
constructor
A new instance of DbSpiderNodeSet.
Constructor Details
#initialize ⇒ DbSpiderNodeSet
Returns a new instance of DbSpiderNodeSet.
4 5 6 7 8 |
# File 'lib/db_facet/db_spider_node_set.rb', line 4 def initialize @set = {} @count = 0 @uniq_count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
2 3 4 |
# File 'lib/db_facet/db_spider_node_set.rb', line 2 def count @count end |
#uniq_count ⇒ Object (readonly)
Returns the value of attribute uniq_count.
2 3 4 |
# File 'lib/db_facet/db_spider_node_set.rb', line 2 def uniq_count @uniq_count end |
Instance Method Details
#find_or_create(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/db_facet/db_spider_node_set.rb', line 10 def find_or_create *args @count += 1 obj = args[0] if node = @set[obj] node else @uniq_count += 1 @set[obj] = DbSpiderReaderNode.new *args end end |