data_display 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26da40d9b4eee470047cc1f55f666aa071365285
4
- data.tar.gz: 5c022f5f34854055622eadbf688607af7acbc8d1
3
+ metadata.gz: ca8b872e316a12227a086da1891079a9a5783346
4
+ data.tar.gz: 679aa4fecfc0aec24f67b4b360f7b33a1102c6e4
5
5
  SHA512:
6
- metadata.gz: 5476108469e2894fd35a87ee99ca5bb5d2d8f65f4e3400000aa1205f5fa947fb89bfd7f2bcf3a86270b901801c814b56c21e8086e18af5173c080fff3be449ff
7
- data.tar.gz: 16bc65050574a4911fa7343d1fd50725d14d94a285e19bfbe95194723df6268f83987df8ca10f17952badc3a4eb616ac8ddcb1897143db8e027151c00091c811
6
+ metadata.gz: 500aadfba01e2390142b24e447256497bfcb3b5763be779f4ad44d67cc956f34da197ad8057ce953a0adea372eb96f912876c8ae2177489baa140db56483e98a
7
+ data.tar.gz: ddc499d3e67f609791a4ce66c91b9c1960fadf5ec63b6dc18e9e8377d3b97804167062f415782efc3ec5b30db159c31fd1fc03d37f970720f81c0bf11650a63e
@@ -7,8 +7,8 @@ module DataDisplay
7
7
  def acts_as_displayable(*args)
8
8
  args = columns.map(&:name) if args.blank?
9
9
  args.each do |attribute|
10
- define_method "#{attribute}_display" do
11
- __data_display__(send(attribute))
10
+ define_method "#{attribute}_display" do |format = nil|
11
+ __data_display__(send(attribute), format)
12
12
  end
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module DataDisplay
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe DataDisplay::ModelAdditions do
4
- let(:user) { create(:user) }
4
+ let(:user) { create(:user, birthday: Date.new(2001,2,3)) }
5
5
  let(:article){ create(:article) }
6
6
 
7
7
  describe 'when model have some displayable attributes' do
@@ -14,6 +14,9 @@ describe DataDisplay::ModelAdditions do
14
14
  it { user.methods.exclude?(:name_display).must_equal true }
15
15
  it { user.methods.exclude?(:id_display).must_equal true }
16
16
  it { user.methods.exclude?(:email_display).must_equal true }
17
+
18
+ it { user.birthday_display.must_equal 'February 03, 2001' }
19
+ it { user.birthday_display(:short).must_equal 'Feb 03' }
17
20
  end
18
21
 
19
22
  describe 'when model have all displayable attributes' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_display
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ramón soto