Class: FluidTable::Context

Inherits:
Struct
  • Object
show all
Defined in:
lib/fluid_table/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fluid_table/context.rb', line 15

def method_missing(method, *args)
  if table.view
    if block_given?
      table.view.send(method, *args) { |*block_args| yield(*block_args) }
    else
      table.view.send(method, *args)
    end
  else
    block_given? ? super { |*block_args| yield(*block_args) } : super
  end
end

Instance Attribute Details

#recordObject

Returns the value of attribute record

Returns:

  • (Object)

    the current value of record



2
3
4
# File 'lib/fluid_table/context.rb', line 2

def record
  @record
end

#tableObject

Returns the value of attribute table

Returns:

  • (Object)

    the current value of table



2
3
4
# File 'lib/fluid_table/context.rb', line 2

def table
  @table
end

Instance Method Details

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/fluid_table/context.rb', line 8

def respond_to?(method)
  view && view.respond_to?(method)
end

#viewObject



4
5
6
# File 'lib/fluid_table/context.rb', line 4

def view
  table.view if table
end