class PIM::DirectPublicationFilter
Constants
- TYPES
Public Class Methods
create(value)
click to toggle source
# File pim.rb, line 10134 def self.create value if PIM.is_hash?(value) value, type = value[:value], value[:type] end return nil if value.nil? if type.nil? if PIM.is_array?(value) type = :array elsif PIM.is_regexp?(value) type = :regexp elsif /\$\{.*\}/.match?(value.to_s) type = :template else type = :string end end type = type.to_sym raise "DirectPublicationFilter type '#{type}' is not valid" unless TYPES.include?(type) value = Array(value.to_s) if type == :array and !PIM.is_array?(value) value = Regexp.new(value.to_s) if type == :regexp and !PIM.is_regexp?(value) value = value.to_s if (type == :string or type == :template) and !PIM.is_string?(value) self.new(value: value, type: type) end
Public Instance Methods
as_json()
click to toggle source
# File pim.rb, line 10165 def as_json { value: value, type: type.to_s.upcase } end
to_json(*args)
click to toggle source
# File pim.rb, line 10172 def to_json *args as_json.to_json(*args) end