Module: Refried::Getter::ClassMethods

Defined in:
lib/refried/getter.rb

Constant Summary collapse

SUPPORTED_MODES =
[:tube_name]

Instance Method Summary collapse

Instance Method Details

#getter_modeSymbol

Get the current mapping mode of the Getter

Returns:

  • (Symbol)

    the current mapping mode of the getter



27
28
29
# File 'lib/refried/getter.rb', line 27

def getter_mode
  @getter_mode ||= :tube_name
end

#getter_mode=(mode) ⇒ Object Also known as: get_mode

Set the mode of function that the Getter should follow

Parameters:

  • mode (Symbol)

    which mapping mode the getter uses, :tube_name



17
18
19
20
21
22
# File 'lib/refried/getter.rb', line 17

def getter_mode=(mode)
  unless SUPPORTED_MODES.include? mode
    raise ArgumentError, "Unsupported mode for acts_as_getter."
  end
  @getter_mode = mode
end