Class: ROM::Plugins::Relation::View::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/plugins/relation/view/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, &block) ⇒ DSL

Returns a new instance of DSL.



12
13
14
15
# File 'lib/rom/plugins/relation/view/dsl.rb', line 12

def initialize(name, &block)
  @name = name
  instance_eval(&block)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



8
9
10
# File 'lib/rom/plugins/relation/view/dsl.rb', line 8

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/rom/plugins/relation/view/dsl.rb', line 6

def name
  @name
end

#relation_blockObject (readonly)

Returns the value of attribute relation_block.



10
11
12
# File 'lib/rom/plugins/relation/view/dsl.rb', line 10

def relation_block
  @relation_block
end

Instance Method Details

#callObject



25
26
27
# File 'lib/rom/plugins/relation/view/dsl.rb', line 25

def call
  [name, attributes, relation_block]
end

#header(*args, &block) ⇒ Object



17
18
19
# File 'lib/rom/plugins/relation/view/dsl.rb', line 17

def header(*args, &block)
  @attributes = args.size > 0 ? args.first : block
end

#relation(&block) ⇒ Object



21
22
23
# File 'lib/rom/plugins/relation/view/dsl.rb', line 21

def relation(&block)
  @relation_block = lambda(&block)
end