Class: RRDNotifier::BindataParser::Packet

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/rrd-grapher/notifier/parsers/bindata_parser.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/rrd-grapher/notifier/parsers/bindata_parser.rb', line 91

def method_missing(m, *args)
  type = PART_TYPE_AS_STRING[m.to_s]
  if type
    p = parts.detect{|p| p.part_type == type }
    p.get_value if p
  end
end

Instance Method Details

#completeObject



103
104
105
106
107
# File 'lib/rrd-grapher/notifier/parsers/bindata_parser.rb', line 103

def complete
  eof ||
  has_part?(VALUES) ||
  has_part?(MESSAGE)
end

#has_part?(type) ⇒ Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/rrd-grapher/notifier/parsers/bindata_parser.rb', line 99

def has_part?(type)
  parts.detect{|p| p.part_type == type }
end