Class: Warp::Dir::Formatter::PointFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/warp/dir/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(point) ⇒ PointFormatter

Returns a new instance of PointFormatter.



41
42
43
# File 'lib/warp/dir/formatter.rb', line 41

def initialize(point)
  @point = point
end

Instance Attribute Details

#pointObject

Returns the value of attribute point.



39
40
41
# File 'lib/warp/dir/formatter.rb', line 39

def point
  @point
end

Instance Method Details

#format(type = DEFAULT_FORMAT, width = 0) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/warp/dir/formatter.rb', line 45

def format(type = DEFAULT_FORMAT, width = 0)
  case type
    when :ascii
      point.to_s(width)
    else
      raise ArgumentError.new("Type #{type} is not recognized.")
  end
end