Class: Kameleon::DSL::Act::SelectTag

Inherits:
Object
  • Object
show all
Defined in:
lib/kameleon/dsl/act/form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action, params) ⇒ SelectTag

Returns a new instance of SelectTag.



49
50
51
52
53
54
# File 'lib/kameleon/dsl/act/form.rb', line 49

def initialize(action, params)
  raise "not implemented" unless params.kind_of?(Hash)
  @action = action
  @actions = []
  parse_params(params)
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



47
48
49
# File 'lib/kameleon/dsl/act/form.rb', line 47

def action
  @action
end

#actionsObject (readonly)

Returns the value of attribute actions.



47
48
49
# File 'lib/kameleon/dsl/act/form.rb', line 47

def actions
  @actions
end

Instance Method Details

#parse_params(params) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/kameleon/dsl/act/form.rb', line 56

def parse_params(params)
  params.each_pair do |option, id|
    case id
      when Symbol
        parse_params(option => id.to_s)
      when String
        if option.kind_of?(Array)
          option.each do |o|
            parse_params(o => id)
          end
        else
          actions << Action.new(action, option.to_s, :from => id)
        end
    end
  end
end