Class: Foxtail::Function::Value

Inherits:
Data
  • Object
show all
Defined in:
lib/foxtail/function/value.rb,
lib/foxtail/function/value.rb

Overview

Base class for deferred-formatting values Wraps a value with formatting options, deferring locale-specific formatting until display time

Direct Known Subclasses

DateTime, Number

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsHash (readonly)

Returns Formatting options.

Returns:

  • (Hash)

    Formatting options



14
15
16
# File 'lib/foxtail/function/value.rb', line 14

def options
  @options
end

#valueObject (readonly)

Returns The wrapped raw value.

Returns:

  • (Object)

    The wrapped raw value



14
15
16
# File 'lib/foxtail/function/value.rb', line 14

def value
  @value
end

Instance Method Details

#formatString

Format the value for display Subclasses may override for locale-specific formatting

Parameters:

  • bundle (Foxtail::Bundle)

    The bundle providing locale and context (unused in base implementation)

Returns:

  • (String)

    The formatted value



19
# File 'lib/foxtail/function/value.rb', line 19

def format(**) = value.to_s

#to_sString

String representation for interpolation

Returns:

  • (String)

    The string representation of the wrapped value



23
# File 'lib/foxtail/function/value.rb', line 23

def to_s = value.to_s