Presentation is loading. Please wait.

Presentation is loading. Please wait.

URails Meeting 004. Ruby Quiz Is the following statement accessing a variable or calling a method? profile.user_name Could be either. Calling a method.

Similar presentations


Presentation on theme: "URails Meeting 004. Ruby Quiz Is the following statement accessing a variable or calling a method? profile.user_name Could be either. Calling a method."— Presentation transcript:

1 URails Meeting 004

2 Ruby Quiz Is the following statement accessing a variable or calling a method? profile.user_name Could be either. Calling a method with no parameters and accessing a variable are syntactically identical

3 Quiz (cont.) What is being store in foo ? foo = { :dogs => “rock” } A Hash. { } with key-value pairs indicate a Hash puts foo[:dogs] # String => “rock”

4 Quiz (cont.) What is being store in foo ? foo = [ “hello”, “world” ] An Array. It has to elements, “hello” and “world” foo[0] # String => “hello”

5 Quiz (cont.) What is being store in foo ? foo = [ { :hello => “greeting” }, { :world => “planet” } ] An Array. It has two elements, a hash with the key/value :hello/”greeting”, and a hash with the key/value :world/”planet”. puts foo[0] # Hash => { :hello => “greeting” } puts foo[0][:hello] # String => “greeting”

6 Quiz (cont.) What is being stored in foo ? foo = { :hi => { :hello => “greeting”, :world => “planet” }} A Hash. It has to elements, a hash with the key :hello, and a hash with the key :world. foo[:hi][:world] # String => “planet”

7 HTML/CSS Quiz How can I change the background color of the p tag to green using CSS? My cool heading Hello! p { background-color:green; }

8 How can I change only the first p tag to have a green background color? First Paragraph Second Paragraph You can’t! (without adding a class or id)

9 How can I change only the first p tag to have a green background color? First Paragraph Second Paragraph.green_color { background-color:green; }

10 div tags div tags can be styled like any other tag, but also have “spacing” and can be thought of as a container div -specific CSS Attributes to be aware of – width – height – margin – padding – border CSS Box Model

11


Download ppt "URails Meeting 004. Ruby Quiz Is the following statement accessing a variable or calling a method? profile.user_name Could be either. Calling a method."

Similar presentations


Ads by Google