Class: AprsIs::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/aprs_is/filter.rb,
lib/aprs_is/filter/constants.rb

Defined Under Namespace

Modules: Constants Classes: InvalidTypeError, ValueArityError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, values:) ⇒ Filter

Returns a new instance of Filter.



10
11
12
13
14
15
16
# File 'lib/aprs_is/filter.rb', line 10

def initialize(type:, values: )
  @filter_type = type
  @values = values || []

  validate_filter_type
  validate_arity
end

Instance Attribute Details

#filter_typeObject (readonly)

Returns the value of attribute filter_type.



8
9
10
# File 'lib/aprs_is/filter.rb', line 8

def filter_type
  @filter_type
end

#valuesObject (readonly)

Returns the value of attribute values.



8
9
10
# File 'lib/aprs_is/filter.rb', line 8

def values
  @values
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/aprs_is/filter.rb', line 18

def to_s
  values.dup.unshift(prefix).compact.join("/")
end