Sha256: a580ebdf4f1533692d161d7ed1e1aaee0861034cfd5b8e4697068e700c567887
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 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 # @return [Boolean] def visible? @visible end # @return [Boolean] 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.3.4 | lib/vedeu/support/visible.rb |
vedeu-0.3.3 | lib/vedeu/support/visible.rb |
vedeu-0.3.2 | lib/vedeu/support/visible.rb |
vedeu-0.3.1 | lib/vedeu/support/visible.rb |