Class: Docks::Descriptor
- Inherits:
-
Object
- Object
- Docks::Descriptor
- Defined in:
- lib/docks/descriptor.rb
Constant Summary collapse
- PATTERN =
/^([^:]*)::/
- INSTANCE_MEMBER =
/#(.*)/
- STATIC_MEMBER =
/\.(.*)/
- LOCAL_MEMBER =
/~(.*)/
- MEMBERS =
[:instance_member, :static_member, :local_member]
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(descriptor_string, options) ⇒ Descriptor
constructor
A new instance of Descriptor.
- #member ⇒ Object
- #member? ⇒ Boolean
Constructor Details
#initialize(descriptor_string, options) ⇒ Descriptor
Returns a new instance of Descriptor.
16 17 18 |
# File 'lib/docks/descriptor.rb', line 16 def initialize(descriptor_string, ) parse(descriptor_string, ) end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
9 10 11 |
# File 'lib/docks/descriptor.rb', line 9 def pattern @pattern end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
9 10 11 |
# File 'lib/docks/descriptor.rb', line 9 def symbol @symbol end |
Class Method Details
.new(descriptor_string, options = {}) ⇒ Object
12 13 14 |
# File 'lib/docks/descriptor.rb', line 12 def self.new(descriptor_string, = {}) descriptor_string.kind_of?(self) ? descriptor_string : super end |
Instance Method Details
#member ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/docks/descriptor.rb', line 24 def member MEMBERS.each do |member_type| member = self.send(member_type) return member unless member.nil? end nil end |
#member? ⇒ Boolean
20 21 22 |
# File 'lib/docks/descriptor.rb', line 20 def member? MEMBERS.any? { |member_type| !self.send(member_type).nil? } end |