Module: Trundle::InfoAccessors

Included in:
TextBundle
Defined in:
lib/trundle/info_accessors.rb

Instance Method Summary collapse

Instance Method Details

#info_accessors(*args) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/trundle/info_accessors.rb', line 2

def info_accessors(*args)
  args.each do |arg|
    key = Trundle::Key.new(arg).camelize

    define_method(arg) do
      info[key]
    end

    define_method("#{arg}=") do |value|
      info[key] = value
    end
  end
end