Class: RSS::BaseListener
Direct Known Subclasses
Constant Summary collapse
- @@accessor_bases =
{}
- @@registered_uris =
{}
- @@class_names =
{}
Class Method Summary collapse
-
.available_tags(uri) ⇒ Object
return the tag_names for setters associated with uri.
-
.class_name(uri, tag_name) ⇒ Object
retrieve class_name for the supplied uri and tag_name If it doesn’t exist, capitalize the tag_name.
- .getter(uri, tag_name) ⇒ Object
-
.install_class_name(uri, tag_name, class_name) ⇒ Object
record class_name for the supplied uri and tag_name.
- .install_get_text_element(uri, name, accessor_base) ⇒ Object
- .raise_for_undefined_entity? ⇒ Boolean
-
.register_uri(uri, name) ⇒ Object
register uri against this name.
-
.setter(uri, tag_name) ⇒ Object
return the setter for the uri, tag_name pair, or nil.
-
.uri_registered?(uri, name) ⇒ Boolean
test if this uri is registered against this name.
Methods included from Utils
element_initialize_arguments?, get_file_and_line_from_caller, new_with_value_if_need, to_class_name
Class Method Details
.available_tags(uri) ⇒ Object
return the tag_names for setters associated with uri
215 216 217 |
# File 'lib/rss/parser.rb', line 215 def (uri) (@@accessor_bases[uri] || {}).keys end |
.class_name(uri, tag_name) ⇒ Object
retrieve class_name for the supplied uri and tag_name If it doesn’t exist, capitalize the tag_name
238 239 240 241 242 243 244 |
# File 'lib/rss/parser.rb', line 238 def class_name(uri, tag_name) name = (@@class_names[uri] || {})[tag_name] return name if name tag_name = tag_name.gsub(/[_\-]([a-z]?)/) {$1.upcase} tag_name[0, 1].upcase + tag_name[1..-1] end |
.getter(uri, tag_name) ⇒ Object
210 211 212 |
# File 'lib/rss/parser.rb', line 210 def getter(uri, tag_name) (@@accessor_bases[uri] || {})[tag_name] end |
.install_class_name(uri, tag_name, class_name) ⇒ Object
record class_name for the supplied uri and tag_name
231 232 233 234 |
# File 'lib/rss/parser.rb', line 231 def install_class_name(uri, tag_name, class_name) @@class_names[uri] ||= {} @@class_names[uri][tag_name] = class_name end |
.install_get_text_element(uri, name, accessor_base) ⇒ Object
246 247 248 249 |
# File 'lib/rss/parser.rb', line 246 def install_get_text_element(uri, name, accessor_base) install_accessor_base(uri, name, accessor_base) def_get_text_element(uri, name, *get_file_and_line_from_caller(1)) end |
.raise_for_undefined_entity? ⇒ Boolean
251 252 253 |
# File 'lib/rss/parser.rb', line 251 def raise_for_undefined_entity? true end |
.register_uri(uri, name) ⇒ Object
register uri against this name.
220 221 222 223 |
# File 'lib/rss/parser.rb', line 220 def register_uri(uri, name) @@registered_uris[name] ||= {} @@registered_uris[name][uri] = nil end |
.setter(uri, tag_name) ⇒ Object
return the setter for the uri, tag_name pair, or nil.
201 202 203 204 205 206 207 208 |
# File 'lib/rss/parser.rb', line 201 def setter(uri, tag_name) _getter = getter(uri, tag_name) if _getter "#{_getter}=" else nil end end |
.uri_registered?(uri, name) ⇒ Boolean
test if this uri is registered against this name
226 227 228 |
# File 'lib/rss/parser.rb', line 226 def uri_registered?(uri, name) @@registered_uris[name].has_key?(uri) end |