Class: Shard::Ref
- Inherits:
-
Struct
- Object
- Struct
- Shard::Ref
- Defined in:
- lib/shard/ref.rb
Constant Summary collapse
- PATTERN =
# Declarations #
#
%r{([a-zA-Z0-9_-]+)/(\w+)}
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#name ⇒ Object
Returns the value of attribute name.
-
#user ⇒ Object
Returns the value of attribute user.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
-
.parse(shard_line) ⇒ Object
# Class Methods # #.
- .valid?(shard_line) ⇒ Boolean
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file
3 4 5 |
# File 'lib/shard/ref.rb', line 3 def file @file end |
#name ⇒ Object
Returns the value of attribute name
3 4 5 |
# File 'lib/shard/ref.rb', line 3 def name @name end |
#user ⇒ Object
Returns the value of attribute user
3 4 5 |
# File 'lib/shard/ref.rb', line 3 def user @user end |
#version ⇒ Object
Returns the value of attribute version
3 4 5 |
# File 'lib/shard/ref.rb', line 3 def version @version end |
Class Method Details
.parse(shard_line) ⇒ Object
# Class Methods #
#
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/shard/ref.rb', line 19 def self.parse(shard_line) if matcher = shard_line.match(PATTERN) user = matcher[1] name = matcher[2] file = nil version = 'HEAD' new(user, name, file, version) else nil end end |
.valid?(shard_line) ⇒ Boolean
32 33 34 |
# File 'lib/shard/ref.rb', line 32 def self.valid?(shard_line) shard_line =~ PATTERN end |