class Attribool::ReaderName
Abstraction of a reader’s method name.
Public Class Methods
new(attribute, name)
click to toggle source
Instantiate new instance of ReaderName
.
@param [String, Syumbol] attribute
@param [proc, nil, String, Symbol] name
# File lib/attribool/reader_name.rb, line 13 def initialize(attribute, name) @attribute = attribute @name = name end
Public Instance Methods
to_s()
click to toggle source
Convert instance to a string.
@return [String]
# File lib/attribool/reader_name.rb, line 22 def to_s case @name when Proc then @name.call(@attribute) when nil then "#{@attribute}?" else @name.to_s end end