Class: Mscgen::Message
- Inherits:
-
Object
- Object
- Mscgen::Message
- Defined in:
- lib/mscgen/message.rb
Defined Under Namespace
Classes: UnknownAllowType
Constant Summary collapse
- ALLOW_TYPE =
acceptable allow type definition
{ :messege => "->", :method => "=>", :method_return => ">>", :callback => "=>>", :emph_message => ":>", :lost_message => "-x", }
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from, to, label = nil, options = {}) ⇒ Message
constructor
- from
- a entity which message from to
- a entity which message to label
- message string options
-
supports :type, :linecolor, :textcolor attributes.
-
#to_msc ⇒ Object
return mscgen format text.
Constructor Details
#initialize(from, to, label = nil, options = {}) ⇒ Message
- from
-
a entity which message from
- to
-
a entity which message to
- label
-
message string
- options
-
supports :type, :linecolor, :textcolor attributes
22 23 24 25 26 27 28 29 |
# File 'lib/mscgen/message.rb', line 22 def initialize(from, to, label=nil, ={}) @from = from @to = to @label = Mscgen.escape(label.to_s) unless label.nil? @options = ( or {}) raise ArgumentError unless @options.kind_of?(Hash) raise UnknownAllowType unless ALLOW_TYPE.has_key?(@options.fetch(:type, :method)) end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
16 17 18 |
# File 'lib/mscgen/message.rb', line 16 def from @from end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
16 17 18 |
# File 'lib/mscgen/message.rb', line 16 def label @label end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
16 17 18 |
# File 'lib/mscgen/message.rb', line 16 def to @to end |
Instance Method Details
#to_msc ⇒ Object
return mscgen format text
32 33 34 35 36 |
# File 'lib/mscgen/message.rb', line 32 def to_msc = "#{@from.name} #{allow} #{@to.name}" += option_string end |