Class: ActionBlocks::BarchartBuilder

Inherits:
BlockType show all
Defined in:
lib/action_blocks/builders/barchart_builder.rb

Instance Attribute Summary

Attributes inherited from BaseBuilder

#dsl_delegate, #id

Instance Method Summary collapse

Methods inherited from BlockType

#is_block?, #type

Methods inherited from BaseBuilder

#after_build, #after_load, array_fields, block_type, builds, builds_many, delegate_class, #evaluate, #freeze, includes_scheme_helpers, #initialize, #is_block?, #key, references, sets, sets_many, #ui_reference, #valid?

Constructor Details

This class inherits a constructor from ActionBlocks::BaseBuilder

Instance Method Details

#before_build(parent, *args) ⇒ Object



11
12
13
14
15
# File 'lib/action_blocks/builders/barchart_builder.rb', line 11

def before_build(parent, *args)
  @id = "#{parent.id}_#{args.first}"
  @title = id.to_s.titleize
  @calculate = :count
end

#hashify(user) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/action_blocks/builders/barchart_builder.rb', line 17

def hashify(user)
  {
    title: @title,
    key: key,
    type: type,
    group: @group.try(:hashify, user),
    subgroup: @subgroup.try(:hashify, user)
  }
end