extract champ value type
This commit is contained in:
parent
809319f593
commit
dda5bc35ed
1 changed files with 12 additions and 4 deletions
|
@ -8,6 +8,14 @@ class Logic::ChampValue < Logic::Term
|
||||||
:text
|
:text
|
||||||
)
|
)
|
||||||
|
|
||||||
|
CHAMP_VALUE_TYPE = {
|
||||||
|
boolean: :boolean,
|
||||||
|
number: :number,
|
||||||
|
string: :string,
|
||||||
|
enum: :enum,
|
||||||
|
empty: :empty
|
||||||
|
}
|
||||||
|
|
||||||
attr_reader :stable_id
|
attr_reader :stable_id
|
||||||
|
|
||||||
def initialize(stable_id)
|
def initialize(stable_id)
|
||||||
|
@ -32,13 +40,13 @@ class Logic::ChampValue < Logic::Term
|
||||||
case type_de_champ.type_champ
|
case type_de_champ.type_champ
|
||||||
when MANAGED_TYPE_DE_CHAMP.fetch(:yes_no),
|
when MANAGED_TYPE_DE_CHAMP.fetch(:yes_no),
|
||||||
MANAGED_TYPE_DE_CHAMP.fetch(:checkbox)
|
MANAGED_TYPE_DE_CHAMP.fetch(:checkbox)
|
||||||
:boolean
|
CHAMP_VALUE_TYPE.fetch(:boolean)
|
||||||
when MANAGED_TYPE_DE_CHAMP.fetch(:integer_number), MANAGED_TYPE_DE_CHAMP.fetch(:decimal_number)
|
when MANAGED_TYPE_DE_CHAMP.fetch(:integer_number), MANAGED_TYPE_DE_CHAMP.fetch(:decimal_number)
|
||||||
:number
|
CHAMP_VALUE_TYPE.fetch(:number)
|
||||||
when MANAGED_TYPE_DE_CHAMP.fetch(:text)
|
when MANAGED_TYPE_DE_CHAMP.fetch(:text)
|
||||||
:string
|
CHAMP_VALUE_TYPE.fetch(:string)
|
||||||
when MANAGED_TYPE_DE_CHAMP.fetch(:drop_down_list)
|
when MANAGED_TYPE_DE_CHAMP.fetch(:drop_down_list)
|
||||||
:enum
|
CHAMP_VALUE_TYPE.fetch(:enum)
|
||||||
else
|
else
|
||||||
raise "unmanaged type: #{type_de_champ.type_champ}"
|
raise "unmanaged type: #{type_de_champ.type_champ}"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue