Sha256: c51120ddc7ff625c1e4180d4c5dbdc0135ec5e77918843971794c2234c25875f

Contents?: true

Size: 698 Bytes

Versions: 8

Compression:

Stored size: 698 Bytes

Contents

require 'rumx'

class MyBean
  include Rumx::Bean

  bean_attr_accessor      :max_messages, :integer, 'The maximum number of messages to keep'
  bean_list_attr_accessor :messages,     :string,  'Message', :max_size => :max_messages

  bean_operation   :push_message, :string, 'Push message onto message list', [
      [ :message, :string, 'A string argument' ]
  ]

  def initialize
    @messages = ['Here', 'are', 'some messages']
    @max_messages = 5
  end

  def push_message(message)
    @messages.push(message)
    @messages.shift while @messages.size > @max_messages
    return message
  end

  def bean_attributes_changed
    @messages.shift while @messages.size > @max_messages
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rumx-0.0.8 examples/list/my_bean.rb
rumx-0.0.7 examples/list/my_bean.rb
rumx-0.0.6 examples/list/my_bean.rb
rumx-0.0.5 examples/list/my_bean.rb
rumx-0.0.4 examples/list/my_bean.rb
rumx-0.0.3 examples/list/my_bean.rb
rumx-0.0.2 examples/list/my_bean.rb
rumx-0.0.1 examples/list/my_bean.rb