glimmer 0.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING.LGPL +504 -0
- data/README +27 -0
- data/samples/contactmanager/contact.rb +12 -0
- data/samples/contactmanager/contact_manager.rb +65 -0
- data/samples/contactmanager/contact_manager_presenter.rb +23 -0
- data/samples/contactmanager/contact_repository.rb +27 -0
- data/samples/hello_world.rb +26 -0
- data/samples/login.rb +97 -0
- data/samples/tictactoe/tic_tac_toe.rb +67 -0
- data/samples/tictactoe/tic_tac_toe_board.rb +149 -0
- data/src/command_handler.rb +11 -0
- data/src/command_handler_chain_factory.rb +23 -0
- data/src/command_handler_chain_link.rb +22 -0
- data/src/command_handlers.rb +26 -0
- data/src/command_handlers/bind_command_handler.rb +29 -0
- data/src/command_handlers/data_binding_command_handler.rb +64 -0
- data/src/command_handlers/models/model_observer.rb +25 -0
- data/src/command_handlers/models/observable_array.rb +46 -0
- data/src/command_handlers/models/observable_model.rb +35 -0
- data/src/command_handlers/models/r_runnable.rb +14 -0
- data/src/command_handlers/models/r_shell.rb +27 -0
- data/src/command_handlers/models/r_widget.rb +146 -0
- data/src/command_handlers/models/r_widget_listener.rb +12 -0
- data/src/command_handlers/models/r_widget_packages.rb +9 -0
- data/src/command_handlers/models/table_items_updater.rb +39 -0
- data/src/command_handlers/models/widget_observer.rb +23 -0
- data/src/command_handlers/shell_command_handler.rb +18 -0
- data/src/command_handlers/swt_constant_command_handler.rb +22 -0
- data/src/command_handlers/table_column_properties_data_binding_command_handler.rb +24 -0
- data/src/command_handlers/table_items_data_binding_command_handler.rb +30 -0
- data/src/command_handlers/widget_command_handler.rb +26 -0
- data/src/command_handlers/widget_listener_command_handler.rb +35 -0
- data/src/command_handlers/widget_method_command_handler.rb +22 -0
- data/src/glimmer.rb +45 -0
- data/src/parent.rb +8 -0
- data/src/shine.rb +24 -0
- data/src/swt.rb +10 -0
- data/src/xml.rb +10 -0
- data/src/xml_command_handlers.rb +18 -0
- data/src/xml_command_handlers/html_command_handler.rb +49 -0
- data/src/xml_command_handlers/models/depth_first_search_iterator.rb +20 -0
- data/src/xml_command_handlers/models/name_space_visitor.rb +21 -0
- data/src/xml_command_handlers/models/node.rb +83 -0
- data/src/xml_command_handlers/models/node_visitor.rb +12 -0
- data/src/xml_command_handlers/models/xml_visitor.rb +62 -0
- data/src/xml_command_handlers/xml_command_handler.rb +22 -0
- data/src/xml_command_handlers/xml_name_space_command_handler.rb +34 -0
- data/src/xml_command_handlers/xml_tag_command_handler.rb +26 -0
- data/src/xml_command_handlers/xml_text_command_handler.rb +22 -0
- data/test/glimmer_constant_test.rb +36 -0
- data/test/glimmer_data_binding_test.rb +236 -0
- data/test/glimmer_listeners_test.rb +61 -0
- data/test/glimmer_shine_data_binding_test.rb +88 -0
- data/test/glimmer_table_data_binding_test.rb +135 -0
- data/test/glimmer_test.rb +233 -0
- data/test/observable_model_test.rb +27 -0
- data/test/r_widget_test.rb +52 -0
- data/test/samples/contactmanager/contact_manager_presenter_test.rb +60 -0
- data/test/samples/tictactoe/tic_tac_toe_test.rb +265 -0
- data/test/xml/glimmer_xml_test.rb +163 -0
- metadata +126 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
# edit to add more packages and support custom widgets
|
5
|
+
class RWidget
|
6
|
+
include_package 'org.eclipse.swt'
|
7
|
+
include_package 'org.eclipse.swt.layout'
|
8
|
+
include_package 'org.eclipse.swt.widgets'
|
9
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/observable_array"
|
5
|
+
require File.dirname(__FILE__) + "/observable_model"
|
6
|
+
|
7
|
+
class TableItemsUpdater
|
8
|
+
include_package 'org.eclipse.swt'
|
9
|
+
include_package 'org.eclipse.swt.widgets'
|
10
|
+
|
11
|
+
def initialize(parent, model_observer, column_properties)
|
12
|
+
@table = parent
|
13
|
+
@model_observer = model_observer
|
14
|
+
@column_properties = column_properties
|
15
|
+
update(@model_observer.evaluate_property)
|
16
|
+
model = model_observer.model
|
17
|
+
model.extend(ObservableModel) unless model.is_a?(ObservableModel)
|
18
|
+
model.add_observer(model_observer.property_name, self)
|
19
|
+
end
|
20
|
+
def update(model_collection=nil)
|
21
|
+
if (model_collection and model_collection.is_a?(Array))
|
22
|
+
model_collection.extend(ObservableArray)
|
23
|
+
model_collection.add_observer(@column_properties, self)
|
24
|
+
@model_collection = model_collection
|
25
|
+
end
|
26
|
+
populate_table(@model_collection, @table, @column_properties)
|
27
|
+
end
|
28
|
+
def populate_table(model_collection, parent, column_properties)
|
29
|
+
parent.widget.removeAll
|
30
|
+
model_collection.each do |model|
|
31
|
+
table_item = TableItem.new(parent.widget, SWT::NONE)
|
32
|
+
for index in 0..(column_properties.size-1)
|
33
|
+
table_item.setText(index, model.send(column_properties[index]).to_s)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
class WidgetObserver
|
5
|
+
attr_reader :widget, :property
|
6
|
+
@@property_type_converters = {
|
7
|
+
:text => Proc.new { |value| value.to_s }
|
8
|
+
}
|
9
|
+
def initialize model, property
|
10
|
+
@widget = model
|
11
|
+
@property = property
|
12
|
+
end
|
13
|
+
def update(value)
|
14
|
+
converted_value = value
|
15
|
+
converter = @@property_type_converters[@property.to_sym]
|
16
|
+
converted_value = converter.call(value) if converter
|
17
|
+
@widget.widget.send "set" + @property.camelcase(true), converted_value unless evaluate_property == converted_value
|
18
|
+
end
|
19
|
+
def evaluate_property
|
20
|
+
@widget.widget.send("get" + @property.camelcase(true))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/../command_handler"
|
5
|
+
require File.dirname(__FILE__) + "/models/r_shell"
|
6
|
+
|
7
|
+
class ShellCommandHandler
|
8
|
+
include CommandHandler
|
9
|
+
|
10
|
+
def can_handle?(parent, command_symbol, *args, &block)
|
11
|
+
command_symbol.to_s == "shell"
|
12
|
+
end
|
13
|
+
|
14
|
+
def do_handle(parent, command_symbol, *args, &block)
|
15
|
+
RShell.send(:new, *args)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/../command_handler"
|
5
|
+
require File.dirname(__FILE__) + "/models/r_widget"
|
6
|
+
|
7
|
+
class SwtConstantCommandHandler
|
8
|
+
include CommandHandler
|
9
|
+
|
10
|
+
include_package 'org.eclipse.swt'
|
11
|
+
|
12
|
+
def can_handle?(parent, command_symbol, *args, &block)
|
13
|
+
args.size == 0 and
|
14
|
+
block == nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def do_handle(parent, command_symbol, *args, &block)
|
18
|
+
puts 'org.eclipse.swt.SWT::' + command_symbol.to_s.upcase
|
19
|
+
eval 'org.eclipse.swt.SWT::' + command_symbol.to_s.upcase
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/../command_handler"
|
5
|
+
require File.dirname(__FILE__) + "/models/r_widget"
|
6
|
+
|
7
|
+
class TableColumnPropertiesDataBindingCommandHandler
|
8
|
+
include CommandHandler
|
9
|
+
|
10
|
+
include_package 'org.eclipse.swt'
|
11
|
+
include_package 'org.eclipse.swt.widgets'
|
12
|
+
|
13
|
+
def can_handle?(parent, command_symbol, *args, &block)
|
14
|
+
parent.is_a?(RWidget) and
|
15
|
+
parent.widget.is_a?(Table) and
|
16
|
+
command_symbol.to_s == "column_properties" and
|
17
|
+
block == nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def do_handle(parent, command_symbol, *args, &block)
|
21
|
+
args
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/../command_handler"
|
5
|
+
require File.dirname(__FILE__) + "/models/r_widget"
|
6
|
+
require File.dirname(__FILE__) + "/models/table_items_updater"
|
7
|
+
|
8
|
+
class TableItemsDataBindingCommandHandler
|
9
|
+
include CommandHandler
|
10
|
+
|
11
|
+
include_package 'org.eclipse.swt.widgets'
|
12
|
+
|
13
|
+
def can_handle?(parent, command_symbol, *args, &block)
|
14
|
+
parent.is_a?(RWidget) and
|
15
|
+
parent.widget.is_a?(Table) and
|
16
|
+
command_symbol.to_s == "items" and
|
17
|
+
args.size == 2 and
|
18
|
+
args[0].is_a?(ModelObserver) and
|
19
|
+
args[0].evaluate_property.is_a?(Array) and
|
20
|
+
args[1].is_a?(Array) and
|
21
|
+
block == nil
|
22
|
+
end
|
23
|
+
|
24
|
+
def do_handle(parent, command_symbol, *args, &block)
|
25
|
+
model_observer = args[0]
|
26
|
+
column_properties = args[1]
|
27
|
+
TableItemsUpdater.new(parent, model_observer, column_properties)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/../command_handler"
|
5
|
+
require File.dirname(__FILE__) + "/models/r_widget"
|
6
|
+
|
7
|
+
class WidgetCommandHandler
|
8
|
+
include CommandHandler
|
9
|
+
|
10
|
+
include_package 'org.eclipse.swt.widgets'
|
11
|
+
|
12
|
+
def can_handle?(parent, command_symbol, *args, &block)
|
13
|
+
parent.is_a?(RWidget) and
|
14
|
+
command_symbol.to_s != "shell" and
|
15
|
+
(args.size == 0 or
|
16
|
+
(args.size == 1 and args[0].is_a?(Fixnum))) and
|
17
|
+
RWidget.widget_exists?(command_symbol.to_s)
|
18
|
+
end
|
19
|
+
|
20
|
+
def do_handle(parent, command_symbol, *args, &block)
|
21
|
+
style = args[0] if args.size == 1
|
22
|
+
puts "style argument is: " + style.to_s
|
23
|
+
RWidget.new(command_symbol.to_s, parent.widget, style)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/../command_handler"
|
5
|
+
require File.dirname(__FILE__) + "/models/r_widget"
|
6
|
+
|
7
|
+
class WidgetListenerCommandHandler
|
8
|
+
include CommandHandler
|
9
|
+
|
10
|
+
include_package 'org.eclipse.swt.widgets'
|
11
|
+
|
12
|
+
def can_handle?(parent, command_symbol, *args, &block)
|
13
|
+
parent.is_a?(RWidget) and
|
14
|
+
command_symbol.to_s[0,3] == "on_" and
|
15
|
+
command_symbol.to_s.length > 3 and
|
16
|
+
args.size == 0 and
|
17
|
+
parent.can_add_listener?(command_symbol.to_s[3, command_symbol.to_s.length])
|
18
|
+
end
|
19
|
+
|
20
|
+
def do_handle(parent, command_symbol, *args, &block)
|
21
|
+
parent.add_listener(command_symbol.to_s[3, command_symbol.to_s.length], &block)
|
22
|
+
ListenerParent.new #TODO refactor and move to models
|
23
|
+
end
|
24
|
+
|
25
|
+
#TODO refactor and move to separate file
|
26
|
+
class ListenerParent
|
27
|
+
include Parent
|
28
|
+
|
29
|
+
def process_block(block)
|
30
|
+
#NOOP
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/../command_handler"
|
5
|
+
require File.dirname(__FILE__) + "/models/r_widget"
|
6
|
+
|
7
|
+
class WidgetMethodCommandHandler
|
8
|
+
include CommandHandler
|
9
|
+
|
10
|
+
def can_handle?(parent, command_symbol, *args, &block)
|
11
|
+
parent.is_a?(RWidget) and
|
12
|
+
args.size > 0 and
|
13
|
+
block == nil and
|
14
|
+
parent.respond_to?(command_symbol, *args)
|
15
|
+
end
|
16
|
+
|
17
|
+
def do_handle(parent, command_symbol, *args, &block)
|
18
|
+
parent.send(command_symbol, *args)
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/src/glimmer.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Glimmer - a JRuby DSL that enables easy and efficient authoring of user-interfaces
|
2
|
+
# using the robust platform-independent Eclipse SWT library. Glimmer comes with built-in
|
3
|
+
# data-binding support to greatly facilitate synchronizing UI with domain models.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
6
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
7
|
+
|
8
|
+
require "rubygems"
|
9
|
+
require "facets"
|
10
|
+
require "java"
|
11
|
+
require File.dirname(__FILE__) + "/parent"
|
12
|
+
|
13
|
+
module Glimmer
|
14
|
+
|
15
|
+
include_package 'org.eclipse.swt'
|
16
|
+
|
17
|
+
@@parent_stack = []
|
18
|
+
|
19
|
+
def self.method_missing(method_symbol, *args, &block)
|
20
|
+
puts "method: " + method_symbol.to_s + " and args: " + args.to_s
|
21
|
+
command_handler_chain = CommandHandlerChainFactory.chain
|
22
|
+
return_value = command_handler_chain.handle(@@parent_stack.last, method_symbol, *args, &block)
|
23
|
+
add_contents(return_value, &block)
|
24
|
+
return return_value
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.add_contents(parent, &block)
|
28
|
+
@@parent_stack.push(parent) if parent.is_a?(Parent)
|
29
|
+
@@parent_stack.last.process_block(block) if block and @@parent_stack.last
|
30
|
+
@@parent_stack.pop if parent.is_a?(Parent)
|
31
|
+
end
|
32
|
+
|
33
|
+
#added for convenience
|
34
|
+
|
35
|
+
def method_missing(method_symbol, *args, &block)
|
36
|
+
Glimmer.method_missing(method_symbol, *args, &block)
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_contents(parent, &block)
|
40
|
+
Glimmer.add_contents(parent, &block)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Command handlers may rely on Glimmer, so this is put here to avoid an infinite loop.
|
45
|
+
#require File.dirname(__FILE__) + "/command_handlers"
|
data/src/parent.rb
ADDED
data/src/shine.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/glimmer"
|
5
|
+
|
6
|
+
class Array
|
7
|
+
include Glimmer
|
8
|
+
|
9
|
+
alias original_compare <=>
|
10
|
+
|
11
|
+
def <=>(other)
|
12
|
+
if (self[0].class.name == "RWidget")
|
13
|
+
add_contents(self[0]) {
|
14
|
+
if (other.size == 2)
|
15
|
+
eval("#{self[1]} bind (other[0], other[1])")
|
16
|
+
elsif (other.size == 3)
|
17
|
+
eval("#{self[1]} bind (other[0], other[1], other[2])")
|
18
|
+
end
|
19
|
+
}
|
20
|
+
else
|
21
|
+
original_compare(other)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/src/swt.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Glimmer - a JRuby DSL that enables easy and efficient authoring of user-interfaces
|
2
|
+
# using the robust platform-independent Eclipse SWT library. Glimmer comes with built-in
|
3
|
+
# data-binding support to greatly facilitate synchronizing UI with domain models.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
6
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
7
|
+
|
8
|
+
require File.dirname(__FILE__) + "/glimmer"
|
9
|
+
require File.dirname(__FILE__) + "/command_handlers"
|
10
|
+
|
data/src/xml.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Glimmer - a JRuby DSL that enables easy and efficient authoring of user-interfaces
|
2
|
+
# using the robust platform-independent Eclipse SWT library. Glimmer comes with built-in
|
3
|
+
# data-binding support to greatly facilitate synchronizing UI with domain models.
|
4
|
+
#
|
5
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
6
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
7
|
+
|
8
|
+
require File.dirname(__FILE__) + "/glimmer"
|
9
|
+
require File.dirname(__FILE__) + "/xml_command_handlers"
|
10
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + "/command_handler_chain_factory"
|
5
|
+
require File.dirname(__FILE__) + "/xml_command_handlers/xml_name_space_command_handler"
|
6
|
+
require File.dirname(__FILE__) + "/xml_command_handlers/xml_text_command_handler"
|
7
|
+
require File.dirname(__FILE__) + "/xml_command_handlers/xml_tag_command_handler"
|
8
|
+
require File.dirname(__FILE__) + "/xml_command_handlers/html_command_handler"
|
9
|
+
require File.dirname(__FILE__) + "/xml_command_handlers/xml_command_handler"
|
10
|
+
|
11
|
+
# edit to add more command handlers and extend Glimmer
|
12
|
+
CommandHandlerChainFactory.set_command_handlers(
|
13
|
+
XmlNameSpaceCommandHandler.new,
|
14
|
+
XmlTextCommandHandler.new,
|
15
|
+
XmlTagCommandHandler.new,
|
16
|
+
HtmlCommandHandler.new,
|
17
|
+
XmlCommandHandler.new
|
18
|
+
)
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require "facets/dictionary"
|
5
|
+
require File.dirname(__FILE__) + "/../command_handler"
|
6
|
+
require File.dirname(__FILE__) + "/models/node"
|
7
|
+
|
8
|
+
class HtmlCommandHandler
|
9
|
+
include CommandHandler
|
10
|
+
|
11
|
+
def can_handle?(parent, command_symbol, *args, &block)
|
12
|
+
(parent == nil or parent.is_a?(Node)) and
|
13
|
+
(args.size == 0 or ((args.size == 1) and ((args[0].is_a?(Hash)) or (args[0].is_a?(Hash)))))
|
14
|
+
end
|
15
|
+
|
16
|
+
def do_handle(parent, command_symbol, *args, &block)
|
17
|
+
attributes = Dictionary.new
|
18
|
+
attributes = args[0] if (args.size == 1)
|
19
|
+
append_id_and_class_attributes(command_symbol.to_s, attributes)
|
20
|
+
tag_name = parse_tag_name(command_symbol.to_s)
|
21
|
+
Node.new(parent, tag_name, attributes, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def parse_tag_name(command)
|
25
|
+
match_data = command.match("_")
|
26
|
+
if (match_data.to_a.size > 0)
|
27
|
+
command.match("_").pre_match
|
28
|
+
else
|
29
|
+
command
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def append_id_and_class_attributes(command, attributes)
|
34
|
+
class_only_match = command.match("__.+").to_s
|
35
|
+
if class_only_match.length > 0
|
36
|
+
class_value = class_only_match[2, class_only_match.length]
|
37
|
+
else
|
38
|
+
match_data = command.match("_[^_]+")
|
39
|
+
return unless match_data
|
40
|
+
match = match_data.to_s
|
41
|
+
id_value = match[1, match.length] if match.length > 0
|
42
|
+
attributes[:id] = id_value if id_value
|
43
|
+
match2 = match_data.post_match.match("_[^_]+").to_s if match_data.post_match
|
44
|
+
class_value = match2[1, match2.length] if match2.length > 0
|
45
|
+
end
|
46
|
+
attributes[:class] = class_value if class_value
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|