Class: Entry::EntryAttributeFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/data/entry_attribute_factory.rb

Overview

Factory class to retrieve the required attribute to the given symbol

Class Method Summary collapse

Class Method Details

.get_attribute_to(symbol, entry) ⇒ Object

method to retrieve the requested attribute for the given Entry::Entry object

Parameters:

  • symbol (Symbol)

    the symbol representing the requested attribute

  • entry (Entry)

    the Entry::Entry whose attribute should be retrieved

Returns:

  • (Object)

    the requested attribute



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/data/entry_attribute_factory.rb', line 12

def self.get_attribute_to(symbol, entry)
  case symbol
  when :source then entry.source
  when :remote_user then entry.remote_user
  when :timestamp then entry.timestamp
  when :http_request then entry.http_request
  when :http_status then entry.http_status
  when :element_size then entry.element_size
  when :http_referer then entry.http_referer
  when :user_agent then entry.user_agent
  else
    raise ArgumentError,
          "Error in EntryAttributeFactory: provided symbol #{symbol}" \
          " does not exist."
  end
end