Class: StarkBank::Utils::Resource
- Inherits:
-
Object
- Object
- StarkBank::Utils::Resource
- Defined in:
- lib/utils/resource.rb
Direct Known Subclasses
Balance, Boleto, Boleto::Log, BoletoPayment, BoletoPayment::Log, Event, Transaction, Transfer, Transfer::Log, StarkBank::User, StarkBank::UtilityPayment, StarkBank::UtilityPayment::Log, Webhook
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(id = nil) ⇒ Resource
constructor
A new instance of Resource.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id = nil) ⇒ Resource
Returns a new instance of Resource.
7 8 9 |
# File 'lib/utils/resource.rb', line 7 def initialize(id = nil) @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/utils/resource.rb', line 6 def id @id end |
Instance Method Details
#inspect ⇒ Object
21 22 23 |
# File 'lib/utils/resource.rb', line 21 def inspect "#{class_name}[#{@id}]" end |
#to_s ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/utils/resource.rb', line 11 def to_s string_vars = [] instance_variables.each do |key| value = instance_variable_get(key).to_s.lines.map(&:chomp).join("\n ") string_vars << "#{key[1..-1]}: #{value}" end fields = string_vars.join(",\n ") "#{class_name}(\n #{fields}\n)" end |