Class: Bud::BudFileReader
- Inherits:
-
BudReadOnly
- Object
- BudCollection
- BudReadOnly
- Bud::BudFileReader
- Defined in:
- lib/bud/collections.rb
Overview
:nodoc: all
Instance Attribute Summary
Attributes inherited from BudCollection
#accumulate_tick_deltas, #bud_instance, #cols, #invalidated, #is_source, #key_cols, #new_delta, #pending, #rescan, #scanner_cnt, #struct, #tabname, #wired_by
Instance Method Summary collapse
- #each(&blk) ⇒ Object
-
#each_raw(&block) ⇒ Object
:nodoc: all.
-
#initialize(name, filename, bud_instance) ⇒ BudFileReader
constructor
:nodoc: all.
- #tick ⇒ Object
Methods inherited from BudReadOnly
#invalidate_at_tick, #invalidate_cache, #merge
Methods inherited from BudCollection
#*, #<<, #<=, #[], #add_rescan_invalidate, #argagg, #argmax, #argmin, #bootstrap, #canonicalize_col, #close, #do_insert, #each_delta, #each_tick_delta, #each_with_index, #empty?, #exists?, #flat_map, #flush, #flush_deltas, #group, #has_key?, #include?, #init_schema, #insert, #inspect, #inspected, #invalidate_at_tick, #keys, #length, #merge, #non_temporal_predecessors, #notin, #null_tuple, #pending_merge, #positive_predecessors, #prep_aggpairs, #pro, #qualified_tabname, #reduce, #register_coll_expr, #rename, #schema, #sort, #tick_deltas, #tick_metrics, #to_push_elem, #uniquify_tabname, #val_cols, #values
Methods included from Enumerable
Constructor Details
#initialize(name, filename, bud_instance) ⇒ BudFileReader
:nodoc: all
1389 1390 1391 1392 1393 1394 1395 1396 1397 |
# File 'lib/bud/collections.rb', line 1389 def initialize(name, filename, bud_instance) # :nodoc: all super(name, bud_instance, {[:lineno] => [:text]}) @filename = filename @storage = {} # NEEDS A TRY/RESCUE BLOCK @fd = File.open(@filename, "r") @linenum = 0 @invalidated = true end |
Instance Method Details
#each(&blk) ⇒ Object
1414 1415 1416 |
# File 'lib/bud/collections.rb', line 1414 def each(&blk) each_raw(&blk) end |
#each_raw(&block) ⇒ Object
:nodoc: all
1404 1405 1406 1407 1408 1409 1410 1411 |
# File 'lib/bud/collections.rb', line 1404 def each_raw(&block) # :nodoc: all while (l = @fd.gets) t = [@linenum, l.strip] @linenum += 1 tick_metrics if bud_instance.[:metrics] yield t end end |
#tick ⇒ Object
1399 1400 1401 |
# File 'lib/bud/collections.rb', line 1399 def tick @invalidated = true end |