Skip to content

Instantly share code, notes, and snippets.

@kcooper22
Created October 23, 2015 13:20
Show Gist options
  • Save kcooper22/2f5e7a66ce2846f2b709 to your computer and use it in GitHub Desktop.
Save kcooper22/2f5e7a66ce2846f2b709 to your computer and use it in GitHub Desktop.
Kyle Cooper WDI Week 04 Assessment
1. Can you execute Ruby in the Chrome console? Why / why not?
Ruby cannot be executed in the chrome console. I am not exectly sure the technical reasons, but I would guess is that chrome does not have an inheret Ruby envirement to execute the code. This is why we had to create the envirement on our local computers.
2. Write some Ruby code that includes a method that fails to work solely because of a scope issue. Think about how Ruby scope differs from Javascript scope.
array = [1,2]
def add
array[0]+array[1]
end
3. How does a Ruby hash differ from a Javascript object?
A hash is more like a library than a fancy array. Hash's can be other data types besides an array.
4. What is an instance variable used for?
An instance variable that only exists inside of a class, so if there are functions that need to occur within that class, those are used. Helpful when importing parameters to instance variables that will be used inside of the class.
5. How does a POST request differ from a GET request?
A GET request only accesses the inforamtion contained inside of a YAML document while a POST allowed the creation of news pieces of information via a curl command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment