class Crowdskout::Components::Value

Attributes

id[RW]
value[RW]

Public Class Methods

create(props) click to toggle source

Factory method to create an Value object from a json string @param [Hash] props - properties to create object from @return [Value]

# File lib/crowdskout/components/profiles/value.rb, line 15
def self.create(props)
  obj = Value.new
  if props
    props.each do |key, value|
      if obj.respond_to? key
        obj.send("#{key}=", value) 
      else
        # this will create the attribute if it doesn't exist
        obj.class.send(:attr_accessor, key)
        obj.instance_variable_set("@#{key}", value)
      end
    end
  end
  obj
end