lib/vedeu/models/escape.rb in vedeu-0.6.7 vs lib/vedeu/models/escape.rb in vedeu-0.6.8
- old
+ new
@@ -1,64 +1,69 @@
module Vedeu
- # Represents an invisible escape character sequence.
- #
- class Escape
+ module Models
- # @!attribute [r] value
- # @return [String]
- attr_reader :value
-
- # Returns a new instance of Vedeu::Escape.
+ # Represents an invisible escape character sequence.
#
- # @param attributes [String]
- # @option attributes position [Vedeu::Geometry::Position|Array<Fixnum>]
- # @option attributes value [String]
- # @return [Vedeu::Escape]
- def initialize(attributes = {})
- defaults.merge!(attributes).each do |key, value|
- instance_variable_set("@#{key}", value)
+ class Escape
+
+ # @!attribute [r] value
+ # @return [String]
+ attr_reader :value
+
+ # Returns a new instance of Vedeu::Models::Escape.
+ #
+ # @param attributes [String]
+ # @option attributes position
+ # [Vedeu::Geometry::Position|Array<Fixnum>]
+ # @option attributes value [String]
+ # @return [Vedeu::Models::Escape]
+ def initialize(attributes = {})
+ defaults.merge!(attributes).each do |key, value|
+ instance_variable_set("@#{key}", value)
+ end
end
- end
- # @return [NilClass]
- def null
- nil
- end
- alias_method :background, :null
- alias_method :colour, :null
- alias_method :foreground, :null
- alias_method :style, :null
+ # @return [NilClass]
+ def null
+ nil
+ end
+ alias_method :background, :null
+ alias_method :colour, :null
+ alias_method :foreground, :null
+ alias_method :style, :null
- # An object is equal when its values are the same.
- #
- # @param other [Vedeu::Views::Char]
- # @return [Boolean]
- def eql?(other)
- self.class == other.class && value == other.value
- end
- alias_method :==, :eql?
+ # An object is equal when its values are the same.
+ #
+ # @param other [Vedeu::Views::Char]
+ # @return [Boolean]
+ def eql?(other)
+ self.class == other.class && value == other.value
+ end
+ alias_method :==, :eql?
- # @return [String]
- def position
- Vedeu::Geometry::Position.coerce(@position)
- end
+ # @return [String]
+ def position
+ Vedeu::Geometry::Position.coerce(@position)
+ end
- # @return [String]
- def to_s
- "#{position}#{value}"
- end
- alias_method :to_str, :to_s
+ # @return [String]
+ def to_s
+ "#{position}#{value}"
+ end
+ alias_method :to_str, :to_s
- private
+ private
- # @return [Hash]
- def defaults
- {
- position: [1, 1],
- value: '',
- }
- end
+ # @return [Hash]
+ def defaults
+ {
+ position: [1, 1],
+ value: '',
+ }
+ end
- end # Escape
+ end # Escape
+
+ end # Models
end # Vedeu