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.



43
44
45
# File 'lib/warp/dir/formatter.rb', line 43

def initialize(point)
  @point = point
end

Instance Attribute Details

#pointObject

Returns the value of attribute point.



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

def point
  @point
end

Instance Method Details

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



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

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