Class: Dms::StringForm

Inherits:
Object
  • Object
show all
Defined in:
lib/dms/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind, flavor: nil, label: nil, modifiers: nil) ⇒ StringForm

Returns a new instance of StringForm.



91
92
93
# File 'lib/dms/types.rb', line 91

def initialize(kind, flavor: nil, label: nil, modifiers: nil)
  @kind = kind; @flavor = flavor; @label = label; @modifiers = modifiers
end

Instance Attribute Details

#flavorObject (readonly)

Returns the value of attribute flavor.



90
91
92
# File 'lib/dms/types.rb', line 90

def flavor
  @flavor
end

#kindObject (readonly)

Returns the value of attribute kind.



90
91
92
# File 'lib/dms/types.rb', line 90

def kind
  @kind
end

#labelObject (readonly)

Returns the value of attribute label.



90
91
92
# File 'lib/dms/types.rb', line 90

def label
  @label
end

#modifiersObject (readonly)

Returns the value of attribute modifiers.



90
91
92
# File 'lib/dms/types.rb', line 90

def modifiers
  @modifiers
end

Class Method Details

.basicObject



94
# File 'lib/dms/types.rb', line 94

def self.basic;    new(:basic); end

.heredoc(flavor, label, modifiers) ⇒ Object



96
97
98
# File 'lib/dms/types.rb', line 96

def self.heredoc(flavor, label, modifiers)
  new(:heredoc, flavor: flavor, label: label, modifiers: modifiers.to_a)
end

.literalObject



95
# File 'lib/dms/types.rb', line 95

def self.literal;  new(:literal); end

Instance Method Details

#==(o) ⇒ Object Also known as: eql?



99
100
101
102
# File 'lib/dms/types.rb', line 99

def ==(o)
  o.is_a?(StringForm) && @kind == o.kind && @flavor == o.flavor &&
    @label == o.label && @modifiers == o.modifiers
end

#hashObject



104
# File 'lib/dms/types.rb', line 104

def hash; [StringForm, @kind, @flavor, @label, @modifiers].hash; end