Class: Gribr::Degrib::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/gribr/degrib/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, inventory_record) ⇒ Message

Returns a new instance of Message.



8
9
10
# File 'lib/gribr/degrib/message.rb', line 8

def initialize(file, inventory_record)
  @file, @inventory_record = file, inventory_record
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



6
7
8
# File 'lib/gribr/degrib/message.rb', line 6

def file
  @file
end

#inventory_recordObject (readonly)

Returns the value of attribute inventory_record.



6
7
8
# File 'lib/gribr/degrib/message.rb', line 6

def inventory_record
  @inventory_record
end

Instance Method Details

#probe(latitude, longitude, options = { }, &block) ⇒ Object

Probe the grib message at the given location and return/yield the records.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gribr/degrib/message.rb', line 14

def probe(latitude, longitude, options = { }, &block)

  records = Array.new

  file.probe(latitude, longitude, options) do |record|

#          if record.element.downcase == inventory_record.element.downcase
      yield(record) if block_given?
      records << record
#          end

  end

  records

end