Class: Phraseapp::Rest::Parameter::Base
- Inherits:
-
Object
- Object
- Phraseapp::Rest::Parameter::Base
- Defined in:
- lib/phraseapp-rest/parameter/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#order ⇒ Object
Returns the value of attribute order.
-
#sort ⇒ Object
Returns the value of attribute sort.
Instance Method Summary collapse
-
#initialize(branch: nil, sort: nil, order: nil) ⇒ Base
constructor
A new instance of Base.
- #to_s ⇒ Object
Constructor Details
#initialize(branch: nil, sort: nil, order: nil) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 |
# File 'lib/phraseapp-rest/parameter/base.rb', line 10 def initialize(branch: nil, sort: nil, order: nil) @branch = branch unless branch.nil? @sort = sort unless sort.nil? self.order = order unless order.nil? end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
7 8 9 |
# File 'lib/phraseapp-rest/parameter/base.rb', line 7 def branch @branch end |
#order ⇒ Object
Returns the value of attribute order.
8 9 10 |
# File 'lib/phraseapp-rest/parameter/base.rb', line 8 def order @order end |
#sort ⇒ Object
Returns the value of attribute sort.
7 8 9 |
# File 'lib/phraseapp-rest/parameter/base.rb', line 7 def sort @sort end |
Instance Method Details
#to_s ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/phraseapp-rest/parameter/base.rb', line 23 def to_s hash = {} params.each do |attr| hash[attr.to_sym] = send(attr) unless send(attr).nil? end hash.to_a.map { |x| "#{x[0]}=#{x[1]}" }.join('&').to_s end |