Class: RocketCMS::PatchDSL

Inherits:
Object
  • Object
show all
Defined in:
lib/rocket_cms/patch.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePatchDSL

Returns a new instance of PatchDSL.


12
13
14
15
16
17
18
19
# File 'lib/rocket_cms/patch.rb', line 12

def initialize
  @model  = Proc.new {}
  @admin  = Proc.new {}
  @list   = Proc.new {}
  @show   = Proc.new {}
  @edit   = Proc.new {}
  @export = Proc.new {}
end

Class Method Details

.call(&blk) ⇒ Object


3
4
5
6
7
8
9
10
# File 'lib/rocket_cms/patch.rb', line 3

def self.call(&blk)
  instance = new
  instance.instance_eval(&blk)
  instance.instance_variables.inject({}) { |result_hash, instance_variable|
    result_hash[instance_variable[1..-1].to_sym] = instance.instance_variable_get(instance_variable)
    result_hash
  }
end

Instance Method Details

#admin(&blk) ⇒ Object


22
# File 'lib/rocket_cms/patch.rb', line 22

def admin(&blk);  @admin = blk;  end

#edit(&blk) ⇒ Object


25
# File 'lib/rocket_cms/patch.rb', line 25

def edit(&blk);   @edit = blk;   end

#export(&blk) ⇒ Object


26
# File 'lib/rocket_cms/patch.rb', line 26

def export(&blk); @export = blk; end

#list(&blk) ⇒ Object


23
# File 'lib/rocket_cms/patch.rb', line 23

def list(&blk);   @list = blk;   end

#model(&blk) ⇒ Object


21
# File 'lib/rocket_cms/patch.rb', line 21

def model(&blk);  @model = blk;  end

#show(&blk) ⇒ Object


24
# File 'lib/rocket_cms/patch.rb', line 24

def show(&blk);   @show = blk;   end