Module: View
- Defined in:
- lib/view.rb,
lib/view/helper.rb,
lib/view/railtie.rb,
lib/view/version.rb,
lib/view/formatter.rb,
lib/view/configuration.rb,
lib/view/formatters/self.rb,
lib/view/formatters/auto.rb,
lib/view/formatters/link.rb,
lib/view/formatters/date.rb,
lib/view/formatters/size.rb,
lib/view/formatters/array.rb,
lib/view/formatters/table.rb,
lib/view/formatters/guess.rb,
lib/view/formatters/phone.rb,
lib/view/formatters/image.rb,
lib/view/formatters/human.rb,
lib/view/formatters/blank.rb,
lib/view/formatters/boolean.rb,
lib/view/formatters/sentence.rb,
lib/view/formatters/currency.rb,
lib/view/formatters/datetime.rb,
lib/view/formatters/file_link.rb,
lib/view/formatters/precision.rb,
lib/view/formatters/html_safe.rb,
lib/view/formatters/delimited.rb,
lib/view/formatters/percentage.rb,
lib/view/formatters/definition_list.rb
Defined Under Namespace
Modules: Helper Classes: Array, Auto, Blank, Boolean, Configuration, Currency, Date, Datetime, DefinitionList, Delimited, FileLink, Formatter, Guess, HtmlSafe, Human, Image, Link, Percentage, Phone, Precision, Railtie, Self, Sentence, Size, Table
Constant Summary
- VERSION =
'1.0.0.alpha.5'
Class Method Summary (collapse)
-
+ (Configuration) configuration
Access to the configuration object.
-
+ (Object) configure {|config| ... }
Configures this gem.
-
+ (String) format(value, options = {}, template = nil) {|formatter| ... }
This is the main method to use this gem.
-
+ (Object) formatters
Contains a list of registered formatters.
Class Method Details
+ (Configuration) configuration
Access to the configuration object
44 45 46 |
# File 'lib/view.rb', line 44 def self.configuration @configuration ||= Configuration.new end |
+ (Object) configure {|config| ... }
Configures this gem
57 58 59 |
# File 'lib/view.rb', line 57 def self.configure yield configuration end |
+ (String) format(value, options = {}, template = nil) {|formatter| ... }
This is the main method to use this gem. Any formatting from outside this gem should be done through this method (notwithstanding custom formatters).
In every day usage you will access it through the view helper method, because most formatters require a view to render links or images.
38 39 40 |
# File 'lib/view.rb', line 38 def self.format(value, = {}, template = nil, &block) Formatter.format(value, , template, &block) end |
+ (Object) formatters
Contains a list of registered formatters
62 63 64 |
# File 'lib/view.rb', line 62 def self.formatters @formatters ||= [] end |