Class: Grouper::Rest::Client::Resource::Stem
- Inherits:
-
Object
- Object
- Grouper::Rest::Client::Resource::Stem
- Defined in:
- lib/grouper-rest-client/resource.rb
Overview
TODO DRY w/ “Group” + “Subject”
Instance Method Summary collapse
-
#[](key) ⇒ Object
Return attribute value for
key
or nil. -
#initialize(resource, json) ⇒ Stem
constructor
A new instance of Stem.
- #to_s ⇒ Object
Constructor Details
#initialize(resource, json) ⇒ Stem
Returns a new instance of Stem.
179 180 181 182 |
# File 'lib/grouper-rest-client/resource.rb', line 179 def initialize(resource, json) @resource = resource @json = json end |
Instance Method Details
#[](key) ⇒ Object
Return attribute value for key
or nil.
185 186 187 188 |
# File 'lib/grouper-rest-client/resource.rb', line 185 def [](key) return @json[key] if @json && @json.key?(key) return nil end |
#to_s ⇒ Object
190 191 192 193 |
# File 'lib/grouper-rest-client/resource.rb', line 190 def to_s return "#{ self.class.name}: #{ @json.keys.sort.collect { |k| "#{ k }=#{ @json[k] }" }.join(', ') }" if @json super end |