lib/ecoportal/api/v2/page/component/selection_option.rb in ecoportal-api-v2-0.8.7 vs lib/ecoportal/api/v2/page/component/selection_option.rb in ecoportal-api-v2-0.8.8

- old
+ new

@@ -2,11 +2,11 @@ module API class V2 class Page class Component class SelectionOption < Common::Content::DoubleModel - + class << self def new_doc { "id" => new_uuid, "weight" => 9999 @@ -15,9 +15,18 @@ end passkey :id passthrough :patch_ver, :name, :value passthrough :weight, :selected + + def numeric! + self.value = block_given?? yield(value) : value.to_i + end + + def text! + self.value = block_given?? yield(value) : value.to_s + end + end end end end end