Class: TaliaCore::SourceTransferObject
- Defined in:
- lib/talia_core/source_transfer_object.rb
Overview
Transfer Object Pattern implementation. It’s required by source administration panel, in order to normalize the values transportation between view and controller layers.
RDF objects (triple endpoint), could be a Source or a String.
java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html java.sun.com/blueprints/patterns/TransferObject.html
TODO: Remove as part of old admin interface?
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(name_or_uri) ⇒ SourceTransferObject
constructor
:nodoc:.
- #source? ⇒ Boolean
-
#titleized ⇒ Object
:nodoc:.
-
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(name_or_uri) ⇒ SourceTransferObject
:nodoc:
15 16 17 18 19 20 21 22 |
# File 'lib/talia_core/source_transfer_object.rb', line 15 def initialize(name_or_uri) #:nodoc: @uri, @name = if /http:\/\//.match name_or_uri uri = N::URI.new(name_or_uri) [uri, uri.local_name] else [nil, name_or_uri] end end |
Instance Attribute Details
#uri ⇒ Object (readonly)
:nodoc:
13 14 15 |
# File 'lib/talia_core/source_transfer_object.rb', line 13 def uri @uri end |
Instance Method Details
#id ⇒ Object
24 25 26 |
# File 'lib/talia_core/source_transfer_object.rb', line 24 def id @name end |
#source? ⇒ Boolean
28 29 30 |
# File 'lib/talia_core/source_transfer_object.rb', line 28 def source? !uri.blank? end |
#titleized ⇒ Object
:nodoc:
32 33 34 |
# File 'lib/talia_core/source_transfer_object.rb', line 32 def titleized #:nodoc: @name.titleize end |
#to_s ⇒ Object
:nodoc:
36 37 38 |
# File 'lib/talia_core/source_transfer_object.rb', line 36 def to_s #:nodoc: (uri || @name).to_s end |