Class: Spree::Admin::Table::Builder

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/admin/table/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry, parent_column = nil) ⇒ Builder

Returns a new instance of Builder.



7
8
9
10
# File 'app/models/spree/admin/table/builder.rb', line 7

def initialize(registry, parent_column = nil)
  @registry = registry
  @parent_column = parent_column
end

Instance Attribute Details

#parent_columnObject (readonly)

Returns the value of attribute parent_column.



5
6
7
# File 'app/models/spree/admin/table/builder.rb', line 5

def parent_column
  @parent_column
end

#registryObject (readonly)

Returns the value of attribute registry.



5
6
7
# File 'app/models/spree/admin/table/builder.rb', line 5

def registry
  @registry
end

Instance Method Details

#add(key, **options, &block) ⇒ Column

Add a column

Parameters:

  • key (Symbol)

    column key

  • options (Hash)

    column options

Returns:



16
17
18
# File 'app/models/spree/admin/table/builder.rb', line 16

def add(key, **options, &block)
  @registry.add(key, **options, &block)
end

#insert_after(target_key, new_key, **options) ⇒ Column?

Insert after another column

Parameters:

  • target_key (Symbol)

    existing column key

  • new_key (Symbol)

    new column key

  • options (Hash)

    column options

Returns:



49
50
51
# File 'app/models/spree/admin/table/builder.rb', line 49

def insert_after(target_key, new_key, **options)
  @registry.insert_after(target_key, new_key, **options)
end

#insert_before(target_key, new_key, **options) ⇒ Column?

Insert before another column

Parameters:

  • target_key (Symbol)

    existing column key

  • new_key (Symbol)

    new column key

  • options (Hash)

    column options

Returns:



40
41
42
# File 'app/models/spree/admin/table/builder.rb', line 40

def insert_before(target_key, new_key, **options)
  @registry.insert_before(target_key, new_key, **options)
end

#remove(key) ⇒ Column?

Remove a column

Parameters:

  • key (Symbol)

    column key

Returns:



23
24
25
# File 'app/models/spree/admin/table/builder.rb', line 23

def remove(key)
  @registry.remove(key)
end

#update(key, **options) ⇒ Column?

Update a column

Parameters:

  • key (Symbol)

    column key

  • options (Hash)

    attributes to update

Returns:



31
32
33
# File 'app/models/spree/admin/table/builder.rb', line 31

def update(key, **options)
  @registry.update(key, **options)
end