Class: Chouette::ObjectId
- Inherits:
-
String
- Object
- String
- Chouette::ObjectId
- Defined in:
- app/models/chouette/object_id.rb
Constant Summary collapse
- @@format =
/^([0-9A-Za-z_]+):([A-Za-z]+):([0-9A-Za-z_-]+)$/
Class Method Summary collapse
Instance Method Summary collapse
- #local_id ⇒ Object
- #object_type ⇒ Object
- #parts ⇒ Object
- #system_id ⇒ Object
- #valid? ⇒ Boolean (also: #objectid?)
Class Method Details
.create(system_id, object_type, local_id) ⇒ Object
27 28 29 |
# File 'app/models/chouette/object_id.rb', line 27 def self.create(system_id, object_type, local_id) new [system_id, object_type, local_id].join(":") end |
.new(string) ⇒ Object
31 32 33 34 |
# File 'app/models/chouette/object_id.rb', line 31 def self.new(string) string ||= "" self === string ? string : super end |
Instance Method Details
#local_id ⇒ Object
23 24 25 |
# File 'app/models/chouette/object_id.rb', line 23 def local_id parts.try(:third) end |
#object_type ⇒ Object
19 20 21 |
# File 'app/models/chouette/object_id.rb', line 19 def object_type parts.try(:second) end |
#parts ⇒ Object
11 12 13 |
# File 'app/models/chouette/object_id.rb', line 11 def parts match(format).try(:captures) end |
#system_id ⇒ Object
15 16 17 |
# File 'app/models/chouette/object_id.rb', line 15 def system_id parts.try(:first) end |
#valid? ⇒ Boolean Also known as: objectid?
3 4 5 |
# File 'app/models/chouette/object_id.rb', line 3 def valid? parts.present? end |