Class: DataAnon::Strategy::Field::SelectFromList

Inherits:
SelectFromFile show all
Defined in:
lib/strategy/field/string/select_from_list.rb

Overview

Select randomly one of the values specified.

anonymize('State').using FieldStrategy::SelectFromList.new(['New York','Georgia',...])

!!!ruby
anonymize('NameTitle').using FieldStrategy::SelectFromList.new(['Mr','Mrs','Dr',...])

Instance Method Summary collapse

Methods inherited from SelectFromFile

#anonymize

Constructor Details

#initialize(values) ⇒ SelectFromList

Returns a new instance of SelectFromList.



16
17
18
# File 'lib/strategy/field/string/select_from_list.rb', line 16

def initialize values
  @values = values.class == Array ? values : [values]
end