Module: ActsAsTable
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/acts_as_table.rb,
lib/acts_as_table/path.rb,
lib/acts_as_table/engine.rb,
lib/acts_as_table/mapper.rb,
lib/acts_as_table/reader.rb,
lib/acts_as_table/writer.rb,
lib/acts_as_table/adapter.rb,
lib/acts_as_table/headers.rb,
lib/acts_as_table/version.rb,
app/models/acts_as_table/lense.rb,
app/models/acts_as_table/table.rb,
app/models/acts_as_table/value.rb,
app/models/acts_as_table/record.rb,
app/models/acts_as_table/has_many.rb,
app/models/acts_as_table/row_model.rb,
app/models/acts_as_table/belongs_to.rb,
app/models/acts_as_table/foreign_key.rb,
app/models/acts_as_table/primary_key.rb,
app/models/acts_as_table/column_model.rb,
app/models/acts_as_table/record_error.rb,
app/models/acts_as_table/record_model.rb,
app/models/acts_as_table/foreign_key_map.rb,
app/models/acts_as_table/has_many_target.rb,
app/models/concerns/acts_as_table/value_provider.rb,
app/models/concerns/acts_as_table/record_model_class_methods.rb,
app/models/concerns/acts_as_table/value_provider_association_methods.rb
Overview
ActsAsTable is a Ruby on Rails plugin for working with tabular data.
Defined Under Namespace
Modules: Headers, Mapper, RecordModelClassMethods, ValueProvider, ValueProviderAssociationMethods Classes: Adapter, BelongsTo, ColumnModel, Configuration, Engine, ForeignKey, ForeignKeyMap, HasMany, HasManyTarget, HeadersNotFound, InvalidHeaders, Lense, Path, PrimaryKey, Reader, ReaderError, Record, RecordError, RecordModel, RowModel, Table, Value, Writer
Constant Summary collapse
- VERSION =
'0.0.4'
Class Method Summary collapse
-
.config ⇒ ActsAsTable::Configuration
Returns the ActsAsTable configuration object.
-
.configure(&block) ⇒ void
Configure ActsAsTable.
-
.for(format) ⇒ Module
Finds an ActsAsTable serialization format module based on a symbolic name.
-
.method_missing(method_name, *args) {|*args, &block| ... } ⇒ Object
Delegates to ActsAsTable configuration object.
-
.respond_to?(method_name, include_all = false) ⇒ Boolean
Delegates to ActsAsTable configuration object.
-
.use(new_adapter, &block) ⇒ Object?
Uses the given ActsAsTable adapter object within the scope of the execution of the given block.
Class Method Details
.config ⇒ ActsAsTable::Configuration
Returns the ActsAsTable configuration object.
228 229 230 |
# File 'lib/acts_as_table.rb', line 228 def self.config Configuration.instance end |
.configure(&block) ⇒ void
This method returns an undefined value.
Configure ActsAsTable.
260 261 262 263 264 265 266 |
# File 'lib/acts_as_table.rb', line 260 def self.configure(&block) if block_given? self.instance_eval(&block) end return end |
.for(format) ⇒ Module
Finds an ActsAsTable serialization format module based on a symbolic name.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/acts_as_table.rb', line 79 def self.for(format) # @return [Hash<Symbol, Module>] module_by_format = self.config.formats.collect { |const_name| self.const_get(const_name, false) }.inject({}) { |acc, m| acc[m.format] ||= m acc } unless module_by_format.key?(format) raise ::ArgumentError.new("invalid format - expected: #{module_by_format.keys.inspect}, found: #{format.inspect}") end module_by_format[format] end |
.method_missing(method_name, *args) {|*args, &block| ... } ⇒ Object
Delegates to ActsAsTable configuration object.
276 277 278 |
# File 'lib/acts_as_table.rb', line 276 def self.method_missing(method_name, *args, &block) self.config.respond_to?(method_name, false) ? self.config.send(method_name, *args, &block) : super(method_name, *args, &block) end |
.respond_to?(method_name, include_all = false) ⇒ Boolean
Delegates to ActsAsTable configuration object.
285 286 287 |
# File 'lib/acts_as_table.rb', line 285 def self.respond_to?(method_name, include_all = false) self.config.respond_to?(method_name, false) || super(method_name, include_all) end |
.use(new_adapter, &block) ⇒ Object?
Uses the given ActsAsTable adapter object within the scope of the execution of the given block.
If block given, yield with no arguments and return the result. Otherwise, return nil.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/acts_as_table.rb', line 102 def self.use(new_adapter, &block) # @return [Object, nil] result = nil if block_given? # @return [ActsAsTable::Adapter] orig_adapter = self.config.adapter begin self.config.adapter = new_adapter result = block.call ensure self.config.adapter = orig_adapter end end result end |