Class: RocketCMS::PatchDSL
- Inherits:
-
Object
- Object
- RocketCMS::PatchDSL
- Defined in:
- lib/rocket_cms/patch.rb
Class Method Summary collapse
Instance Method Summary collapse
- #admin(&blk) ⇒ Object
- #edit(&blk) ⇒ Object
- #export(&blk) ⇒ Object
-
#initialize ⇒ PatchDSL
constructor
A new instance of PatchDSL.
- #list(&blk) ⇒ Object
- #model(&blk) ⇒ Object
- #show(&blk) ⇒ Object
Constructor Details
#initialize ⇒ PatchDSL
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 |