Class: XRD::Link
- Inherits:
-
Object
- Object
- XRD::Link
- Includes:
- SAXMachine, Properties
- Defined in:
- lib/xrd/link.rb
Instance Method Summary collapse
-
#inspect ⇒ String
Returns a
String
representation of the link object’s state. - #title(lang = nil) ⇒ Object
Methods included from Properties
Instance Method Details
#inspect ⇒ String
Returns a String
representation of the link object’s state.
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/xrd/link.rb', line 32 def inspect if self.template sprintf( "#<%s:%#0x TEMPLATE:%s>", self.class.to_s, self.object_id, self.template ) else sprintf( "#<%s:%#0x HREF:%s>", self.class.to_s, self.object_id, self.href ) end end |
#title(lang = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/xrd/link.rb', line 17 def title(lang=nil) title = self.titles.detect { |t| t.lang == lang } unless title title = self.titles.detect { |t| t.lang == nil } end unless title title = self.titles.detect { |t| t.lang == 'en' } end return title end |