Class: Brainstem::TestHelpers::BrainstemDataHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/brainstem/test_helpers.rb

Defined Under Namespace

Classes: BrainstemHelperCollection, BrainstemHelperItem

Instance Method Summary collapse

Constructor Details

#initialize(response_body) ⇒ BrainstemDataHelper

Returns a new instance of BrainstemDataHelper.



35
36
37
# File 'lib/brainstem/test_helpers.rb', line 35

def initialize(response_body)
  @json = JSON.parse(response_body)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



39
40
41
42
# File 'lib/brainstem/test_helpers.rb', line 39

def method_missing(name)
  data = @json[name.to_s].try(:values)
  BrainstemHelperCollection.new(data) unless data.nil?
end