Sha256: 49a114e4bdfc4ea0a5c396cc7ba63fa8d97e3d88e1491ef32f8568546960f6db
Contents?: true
Size: 915 Bytes
Versions: 27
Compression:
Stored size: 915 Bytes
Contents
module TaliaCore #:nodoc: # 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. # # http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html # http://java.sun.com/blueprints/patterns/TransferObject.html class SourceTransferObject attr_reader :uri 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 def id @name end def source? !uri.blank? end def titleized #:nodoc: @name.titleize end def to_s #:nodoc: (uri || @name).to_s end end end
Version data entries
27 entries across 27 versions & 1 rubygems