Class: JQuery::Method
- Inherits:
-
Object
- Object
- JQuery::Method
- Defined in:
- lib/jquery-cheat.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#cat ⇒ Object
Returns the value of attribute cat.
-
#examples ⇒ Object
Returns the value of attribute examples.
-
#long ⇒ Object
Returns the value of attribute long.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#param_order ⇒ Object
Returns the value of attribute param_order.
-
#params ⇒ Object
Returns the value of attribute params.
-
#short ⇒ Object
Returns the value of attribute short.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(elem) ⇒ Method
constructor
A new instance of Method.
- #signature ⇒ Object
Constructor Details
#initialize(elem) ⇒ Method
Returns a new instance of Method.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jquery-cheat.rb', line 13 def initialize elem @name = elem.attributes["name"] @short = elem.attributes["short"] @long = elem.search("> desc").inner_text @cat = elem.attributes["cat"] @params = elem.search("params").inject({}) {|s,p| s.merge(p.attributes["name"] => [p.search("desc").inner_text, p.attributes["type"]]) } @param_order = elem.search("params").map {|p| p.attributes["name"]} @options = elem.search("options").inject({}) {|s,p| s.merge(p.attributes["name"] => [p.search("desc").inner_text, p.attributes["type"]]) } @type = elem.attributes["type"] @examples = elem.search("examples").map do |example| {:desc => example.search("desc").inner_text, :before => example.search("before").inner_text, :code => example.search("code").inner_text, :result => example.search("result").inner_text } end @attributes = elem.attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def attributes @attributes end |
#cat ⇒ Object
Returns the value of attribute cat.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def cat @cat end |
#examples ⇒ Object
Returns the value of attribute examples.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def examples @examples end |
#long ⇒ Object
Returns the value of attribute long.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def long @long end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def @options end |
#param_order ⇒ Object
Returns the value of attribute param_order.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def param_order @param_order end |
#params ⇒ Object
Returns the value of attribute params.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def params @params end |
#short ⇒ Object
Returns the value of attribute short.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def short @short end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/jquery-cheat.rb', line 11 def type @type end |
Instance Method Details
#signature ⇒ Object
33 34 35 |
# File 'lib/jquery-cheat.rb', line 33 def signature "#{name}#{"(#{ param_order.join(", ") })" if !attributes["property"] } in #{cat}" end |