Class: Rhom::RhomSource
- Extended by:
- RhomObject
- Includes:
- RhomObject
- Defined in:
- lib/framework/rhom/rhom_source.rb,
lib/framework/autocomplete/Rhom.rb
Instance Attribute Summary collapse
-
#backend_refresh_time ⇒ Object
readonly
Returns the value of attribute backend_refresh_time.
-
#distinct_objects ⇒ Object
readonly
Returns the value of attribute distinct_objects.
-
#last_deleted_size ⇒ Object
readonly
Returns the value of attribute last_deleted_size.
-
#last_inserted_size ⇒ Object
readonly
Returns the value of attribute last_inserted_size.
-
#last_sync_duration ⇒ Object
readonly
Returns the value of attribute last_sync_duration.
-
#last_sync_success ⇒ Object
readonly
Returns the value of attribute last_sync_success.
-
#last_updated ⇒ Object
readonly
Returns the value of attribute last_updated.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#partition ⇒ Object
readonly
Returns the value of attribute partition.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
-
#schema_version ⇒ Object
readonly
Returns the value of attribute schema_version.
-
#source_id ⇒ Object
readonly
Returns the value of attribute source_id.
Class Method Summary collapse
Instance Method Summary collapse
- #get_lastsync_objectcount ⇒ Object
-
#initialize(args, count = 0) ⇒ RhomSource
constructor
A new instance of RhomSource.
Methods included from RhomObject
djb_hash, extract_options, method_name_reserved?, strip_braces
Constructor Details
#initialize(args, count = 0) ⇒ RhomSource
Returns a new instance of RhomSource.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/framework/rhom/rhom_source.rb', line 38 def initialize(args,count=0) # setup the name # TODO: should really store this in the database #Rho::RhoConfig::sources.each do |key,value| # if value['source_id'].to_i == args['source_id'].to_i # @name = key # end #end @name = args['name'] @source_id = args['source_id'].to_i @last_updated = Time.at(args['last_updated'].to_i) @last_inserted_size = args['last_inserted_size'].to_i @last_deleted_size = args['last_deleted_size'].to_i @last_sync_duration = args['last_sync_duration'].to_i @last_sync_success = args['last_sync_success'].to_i == 1 ? true : false @backend_refresh_time = Time.at(args['backend_refresh_time'].to_i) @partition = args['partition'] @schema = args['schema'] @schema_version = args['schema_version'] #VERY SLOW OPERATION! #@distinct_objects = ::Rhom::RhomDbAdapter::select_from_table( # 'object_values', # 'object', # {"source_id"=>@source_id}, # {"distinct"=>true}).length end |
Instance Attribute Details
#backend_refresh_time ⇒ Object (readonly)
Returns the value of attribute backend_refresh_time.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def backend_refresh_time @backend_refresh_time end |
#distinct_objects ⇒ Object (readonly)
Returns the value of attribute distinct_objects.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def distinct_objects @distinct_objects end |
#last_deleted_size ⇒ Object (readonly)
Returns the value of attribute last_deleted_size.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def last_deleted_size @last_deleted_size end |
#last_inserted_size ⇒ Object (readonly)
Returns the value of attribute last_inserted_size.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def last_inserted_size @last_inserted_size end |
#last_sync_duration ⇒ Object (readonly)
Returns the value of attribute last_sync_duration.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def last_sync_duration @last_sync_duration end |
#last_sync_success ⇒ Object (readonly)
Returns the value of attribute last_sync_success.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def last_sync_success @last_sync_success end |
#last_updated ⇒ Object (readonly)
Returns the value of attribute last_updated.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def last_updated @last_updated end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def name @name end |
#partition ⇒ Object (readonly)
Returns the value of attribute partition.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def partition @partition end |
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def schema @schema end |
#schema_version ⇒ Object (readonly)
Returns the value of attribute schema_version.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def schema_version @schema_version end |
#source_id ⇒ Object (readonly)
Returns the value of attribute source_id.
33 34 35 |
# File 'lib/framework/rhom/rhom_source.rb', line 33 def source_id @source_id end |
Class Method Details
.find(args) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/framework/rhom/rhom_source.rb', line 87 def find(*args) if args.first == :all || args.first == :first list = [] ::Rho::RHO.get_db_partitions.each_value do |db| results = db.select_from_table('sources', '*') results.each do |result| list << RhomSource.new(result) end end if args.first == :first return list.length > 0 ? list[0] : nil end list else ::Rho::RHO.get_db_partitions.each_value do |db| result = ::Rho::RHO.get_src_db().select_from_table('sources', '*', {"name" => args.first}) next unless result && result.length() > 0 return RhomSource.new(result.first) end return nil end end |
.find_all_ashash ⇒ Object
121 122 123 124 125 126 127 128 129 |
# File 'lib/framework/rhom/rhom_source.rb', line 121 def find_all_ashash ar = find(:all) res = {} ar.each do |src| res[src.name] = src end res end |
.load_all_sources ⇒ Object
83 84 85 |
# File 'lib/framework/rhom/rhom_source.rb', line 83 def load_all_sources Rho::RHO.load_all_sources() end |