Module: Ohbjects::Buildable
- Included in:
- AccountBuilder, OptionBuilder, QuoteBuilder
- Defined in:
- lib/ohbjects.rb
Instance Attribute Summary collapse
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Class Method Summary collapse
Instance Method Summary collapse
- #build?(doc) ⇒ Boolean
- #builds(css_or_xpath) ⇒ Object
-
#underscore(camel_cased_word) ⇒ Object
Taken from active support.
Instance Attribute Details
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
14 15 16 |
# File 'lib/ohbjects.rb', line 14 def spec @spec end |
Class Method Details
.extended(extender) ⇒ Object
33 34 35 |
# File 'lib/ohbjects.rb', line 33 def self.extended(extender) REGISTRY << extender end |
Instance Method Details
#build?(doc) ⇒ Boolean
20 21 22 |
# File 'lib/ohbjects.rb', line 20 def build?(doc) !doc.search(@spec).empty? end |
#builds(css_or_xpath) ⇒ Object
16 17 18 |
# File 'lib/ohbjects.rb', line 16 def builds(css_or_xpath) @spec = css_or_xpath end |
#underscore(camel_cased_word) ⇒ Object
Taken from active support.
25 26 27 28 29 30 31 |
# File 'lib/ohbjects.rb', line 25 def underscore(camel_cased_word) camel_cased_word.to_s. gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_"). downcase end |