1 / 11

URails

URails. Meeting 004. Ruby Quiz. Is the following statement accessing a variable or calling a method? p rofile.user_name Could be either. Calling a method with no parameters and accessing a variable are syntactically identical. Quiz (cont.). What is being store in foo ?

helga
Download Presentation

URails

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 ptag to green using CSS? <h1> My cool heading </h1> <p> Hello! </p> p { background-color:green; }

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

  9. How can I change only the first ptag to have a green background color? <p class=“green_color”> First Paragraph </p> <p> Second Paragraph </p> .green_color { background-color:green; }

  10. div tags • divtags 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. CSS Box Model

More Related