class Collins::AssetType
Attributes
id[RW]
label[RW]
name[RW]
Public Class Methods
from_json(json)
click to toggle source
# File lib/collins/asset_type.rb, line 9 def self.from_json json Collins::AssetType.new json end
new(opts = {})
click to toggle source
# File lib/collins/asset_type.rb, line 13 def initialize opts = {} hash = symbolize_hash(opts).inject({}) do |result, (k,v)| key = k.to_s.downcase.to_sym result[key] = v result end @id = hash[:id].to_s.to_i @label = hash[:label].to_s @name = hash[:name].to_s end
Public Instance Methods
empty?()
click to toggle source
# File lib/collins/asset_type.rb, line 24 def empty? @id == 0 end
to_s()
click to toggle source
# File lib/collins/asset_type.rb, line 28 def to_s if empty? then "AssetType(None)" else "AssetType(id = #{id}, name = '#{name}', label = '#{label}')" end end