author  scor <scorlosquet@gmail.com> 
Fri, 14 Mar 2014 12:03:13 0400  
changeset 179  b4c3ad199322 
permissions  rwrr 
179
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

1 
<!DOCTYPE html> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

2 
<html> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

3 
<head> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

4 
<title>Web Schemas TF: Schema.org tests: test 1 (format md)</title> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

5 
</head> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

6 
<body itemscope itemtype="http://schema.org/QAPage"> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

7 

b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

8 
<! inspired from https://stackoverflow.com/questions/4370960/whatisattraccessorinruby > 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

9 
<div itemscope itemtype="http://schema.org/Question"> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

10 
<h1 itemprop="name">What is attr_accessor in Ruby?</h1> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

11 
<! Uses a new madeup property 'voteCount' because stackoverflow doesn't show up/down votes, 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

12 
see http://lists.w3.org/Archives/Public/publicvocabs/2014Feb/0088.html > 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

13 
<div itemprop="voteCount">196</div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

14 
<! There is uncertainty around description vs. text, probably not something we 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

15 
should solve in this proposal though. Using text for now > 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

16 
<div itemprop="text">I am having a hard time understanding attr_accessors in Ruby, can someone explain them to me? I have done tons of Google searches, just can't understand them fully.</div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

17 
<div>asked <time itemprop="dateCreated" datetime="20101206T21:07Z">Dec 6 '10 at 21:07</time></div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

18 
<div itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">dennismonsewicz</span></div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

19 
<div><span itemprop="answerCount">6</span> answers</div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

20 

b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

21 
<div itemprop="suggestedAnswer acceptedAnswer" itemscope itemtype="http://schema.org/Answer"> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

22 
<div itemprop="voteCount">542</div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

23 
<div itemprop="text"> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

24 
Let's say you have a class Person. 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

25 
class Person 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

26 
end 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

27 
person = Person.new 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

28 
person.name # => no method error 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

29 

b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

30 
Obviously we never defined method name. Let's do that. 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

31 
</div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

32 
<div>answered <time itemprop="dateCreated" datetime="20101206T22:11Z">Dec 6 '10 at 22:11</time></div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

33 
<div itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">hakunin</span></div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

34 
<div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

35 

b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

36 
<div itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer"> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

37 
<div itemprop="voteCount">39</div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

38 
<div itemprop="text"> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

39 
attr_accesssor is just a method. (The link should provide more insight with how it works  look at the pairs of methods generated, and a tutorial should show you how to use it.) 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

40 
</div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

41 
<div>answered <time itemprop="dateCreated" datetime="20101206T21:11Z">Dec 6 '10 at 21:11</time></div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

42 
<div itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">user166390</span></div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

43 
<div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

44 

b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

45 

b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

46 
</div> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

47 

b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

48 
</body> 
b4c3ad199322
Add example inspired from stackoverflow for QA proposal
scor <scorlosquet@gmail.com>
parents:
diff
changeset

49 
</html> 