Class: Rose::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/rose/shell.rb

Overview

This class is a wrapper around Seedling that provides methods we don’t want invoked within the Rose#make DSL.

A seedling with a shell is still a seedling. Hence, it should be have as such!

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(seedling) ⇒ Shell

Returns a new instance of Shell.



11
12
13
# File 'lib/rose/shell.rb', line 11

def initialize(seedling)
  @seedling = seedling
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &blk) ⇒ Object

Delegates methods to the current seedling



36
37
38
# File 'lib/rose/shell.rb', line 36

def method_missing(*args, &blk)
  @seedling.send(*args, &blk)
end

Instance Attribute Details

#seedlingRose::Seedling (readonly)

Returns the current seedling.

Returns:



9
10
11
# File 'lib/rose/shell.rb', line 9

def seedling
  @seedling
end

Instance Method Details

#bloom(items = [], options = {}) ⇒ Ruport::Data::RoseTable

Provides bulk exporting

Parameters:

  • items (Array) (defaults to: [])

    the items to sprout the seedling with

Returns:



18
19
20
21
22
23
# File 'lib/rose/shell.rb', line 18

def bloom(items=[], options={})
  @seedling.adapter.sprout(@seedling, @seedling.options.merge(options).merge(
    :attributes => @seedling.row.attributes,
    :items => items
  ))
end

#photosynthesize(items = [], options = {}) ⇒ Object

Provides bulk importing

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :with (Hash, String) — default: required

    a Hash of identity (id) => attribute pairs, or a String to a CSV file to update the seedling with

  • :preview (true, false) — default: false

    whether or not to use the previewer



29
30
31
32
33
# File 'lib/rose/shell.rb', line 29

def photosynthesize(items=[], options={})
  @seedling.adapter.osmosis(@seedling, @seedling.options.merge(options).merge(
    :items => items
  ))
end