Sha256: c3b149650a949373f360e7622ed9a5c14a90e1d194751c5ae1f4052784ea1505
Contents?: true
Size: 1.33 KB
Versions: 22
Compression:
Stored size: 1.33 KB
Contents
module Ecoportal module API class V2 class Page class Component class SelectionOption < Common::Content::DoubleModel class << self def new_doc { "id" => new_uuid, "weight" => 9999 } end end passkey :id passforced :patch_ver, default: 1 passthrough :name, :value passthrough :weight passboolean :selected def name doc["name"] || "#{value}" end def delete! _parent.delete!(self) end def numeric! self.value = block_given?? yield(value) : to_i(value) end def text! self.value = block_given?? yield(value) : value.to_s end private def to_i(value) Float(value).to_i end # https://stackoverflow.com/a/5661695/4352306 def is_number?(value) begin true if Float(value) rescue ArgumentError => e false end end end end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems