Module: WorkOS::HashProvider
- Included in:
- AuditLogAction, AuditLogExport, AuditLogsRetention, Types::BaseModel, WebhookEndpoint
- Defined in:
- lib/workos/hash_provider.rb
Instance Method Summary collapse
Instance Method Details
#inspect ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/workos/hash_provider.rb', line 16 def inspect attrs = self.class::HASH_ATTRS.values.filter_map do |attr_name| value = instance_variable_get(:"@#{attr_name}") next if value.nil? "#{attr_name}=#{value.inspect}" end return "#<#{self.class}>" if attrs.empty? "#<#{self.class} #{attrs.join(" ")}>" end |
#to_h ⇒ Object
6 7 8 9 10 |
# File 'lib/workos/hash_provider.rb', line 6 def to_h self.class::HASH_ATTRS.each_with_object({}) do |(raw_key, attr_name), hash| hash[raw_key] = serialize_field(instance_variable_get(:"@#{attr_name}")) end end |
#to_json(*args) ⇒ Object
12 13 14 |
# File 'lib/workos/hash_provider.rb', line 12 def to_json(*args) to_h.to_json(*args) end |