Sha256: 371a756b07f71e08e48f6badbd2fd6f73999139fe5b1972f5a2d6e94e28ff98b
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'vedeu/support/esc' module Vedeu class Visible # @return [Visible] def self.coerce(value) if value.is_a?(self) value else new(value) end end # @return [Visible] def initialize(visible = nil) @visible = if visible == :hide || visible == false false elsif visible == :show || visible == true true else !!visible end end # Returns log friendly output. # # @return [String] def inspect "<#{self.class.name} (#{@visible.to_s})>" end # @return [String] def cursor if visible? Esc.string('show_cursor') else Esc.string('hide_cursor') end end def visible? @visible end def invisible? !@visible end # @return [Visible] def hide Visible.new(false) end # @return [Visible] def show Visible.new(true) end # @return [Visible] def toggle visible? ? hide : show end end # Visible end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.3.0 | lib/vedeu/support/visible.rb |