Class: AIXM::F

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/aixm/f.rb

Overview

Radio frequency for communication, navigation and so forth.

Examples:

AIXM.f(123.35, :mhz)

Constant Summary collapse

UNITS =
i(ghz mhz khz).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(freq, unit) ⇒ F


24
25
26
# File 'lib/aixm/f.rb', line 24

def initialize(freq, unit)
  self.freq, self.unit = freq, unit
end

Instance Attribute Details

#freqFloat


19
20
21
# File 'lib/aixm/f.rb', line 19

def freq
  @freq
end

#unitSymbol


22
23
24
# File 'lib/aixm/f.rb', line 22

def unit
  @unit
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

See Also:

  • Object#==

56
57
58
# File 'lib/aixm/f.rb', line 56

def ==(other)
  self.class === other && freq == other.freq && unit == other.unit
end

#between?(lower_freq, upper_freq, unit) ⇒ Boolean


50
51
52
# File 'lib/aixm/f.rb', line 50

def between?(lower_freq, upper_freq, unit)
  freq.between?(lower_freq, upper_freq) && self.unit == unit
end

#hashInteger

See Also:

  • Object#hash

63
64
65
# File 'lib/aixm/f.rb', line 63

def hash
  to_s.hash
end

#inspectString


29
30
31
# File 'lib/aixm/f.rb', line 29

def inspect
  %Q(#<#{self.class} #{to_s}>)
end

#to_sString


34
35
36
# File 'lib/aixm/f.rb', line 34

def to_s
  [freq, unit].join(' ')
end

#zero?Boolean


16
# File 'lib/aixm/f.rb', line 16

def_delegator :@freq, :zero?