Class: Logisticed::Logisticer::ListenerStruct

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/logisticed/logisticer.rb

Defined Under Namespace

Classes: ArgumentError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, column, options) ⇒ ListenerStruct

Returns a new instance of ListenerStruct.



58
59
60
61
62
63
# File 'lib/logisticed/logisticer.rb', line 58

def initialize(klass, column, options)
  @klass   = klass
  @column  = column.to_s
  @options = options
  @values  = options[:values]
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



57
58
59
# File 'lib/logisticed/logisticer.rb', line 57

def column
  @column
end

#klassObject (readonly)

Returns the value of attribute klass.



57
58
59
# File 'lib/logisticed/logisticer.rb', line 57

def klass
  @klass
end

#optionsObject (readonly)

Returns the value of attribute options.



57
58
59
# File 'lib/logisticed/logisticer.rb', line 57

def options
  @options
end

#valuesObject (readonly)

Returns the value of attribute values.



57
58
59
# File 'lib/logisticed/logisticer.rb', line 57

def values
  @values
end

Instance Method Details

#normalize_valuesObject



65
66
67
68
69
70
71
72
73
74
# File 'lib/logisticed/logisticer.rb', line 65

def normalize_values
  @normalize_values ||= \
    if options[:only].present?
      (column_enum_values & options[:only]).uniq
    elsif options[:except].present?
      (column_enum_values - options[:only]).uniq
    else
      column_enum_values
    end
end