Class: AffiliateProgram::GenderType

Inherits:
Object
  • Object
show all
Includes:
EnumField::DefineEnum
Defined in:
app/models/affiliate_program/gender_type.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ GenderType

Returns a new instance of GenderType.



9
10
11
# File 'app/models/affiliate_program/gender_type.rb', line 9

def initialize(code)
  @code = code.to_sym
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



7
8
9
# File 'app/models/affiliate_program/gender_type.rb', line 7

def code
  @code
end

Class Method Details

.to_jsonObject



17
18
19
# File 'app/models/affiliate_program/gender_type.rb', line 17

def self.to_json
  all.map { |s| { id: s.id, title: s.title } }
end

Instance Method Details

#titleObject



13
14
15
# File 'app/models/affiliate_program/gender_type.rb', line 13

def title
  I18n.t(code, scope: [:affiliate_program, :gender_type])
end