Skip to content
This repository has been archived by the owner on Sep 30, 2018. It is now read-only.

Commit

Permalink
Some slight code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 17, 2013
1 parent 7ca95e1 commit d36482b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ gemspec

gem 'opal', :github => 'opal/opal'
gem 'opal-jquery', :github => 'opal/opal-jquery'
gem 'opal-spec', :github => 'opal/opal-spec'
18 changes: 13 additions & 5 deletions opal/vienna/attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ def attributes(*attributes)
attributes.each { |name| attribute name }
end

def attribute(attr_name)
columns << attr_name

attr_accessor attr_name
def attribute(name)
columns << name
attr_accessor name
end

def columns
Expand All @@ -21,7 +20,7 @@ def primary_key(primary_key = nil)
end

def self.included(klass)
klass.extend ClassMethods
klass.extend(ClassMethods)
end

def [](attribute)
Expand All @@ -42,5 +41,14 @@ def attributes=(attributes)
end
end
end

def initialize(attributes = nil)
@attributes = {}
@new_record = true
@loaded = false

self.attributes = attributes if attributes
end
end
end

19 changes: 5 additions & 14 deletions opal/vienna/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,16 @@ module Vienna
class Model
include Attributes
include Persistence

include Eventable
extend Eventable

primary_key :id

attr_accessor :id

def self.inherited(subclass)
subclass.reset!
class << self
def inherited(subclass)
subclass.reset!
end
end

def initialize(attributes = nil)
@attributes = {}
@new_record = true
@loaded = false

self.attributes = attributes if attributes
end
attr_accessor :id

def self.from_form(form)
attrs = {}
Expand Down
3 changes: 2 additions & 1 deletion opal/vienna/view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def create_element
end
end

def render; end
def render
end

def class_name
""
Expand Down

0 comments on commit d36482b

Please sign in to comment.