facets 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ProjectInfo +32 -25
- data/data/facets/index.yml +30 -6
- data/data/facets/units/binary/base.yaml +12 -0
- data/data/facets/units/binary/extra.yaml +8 -0
- data/data/facets/units/cex.yaml +7 -0
- data/data/facets/units/currency/base.yaml +268 -0
- data/data/facets/units/default.yaml +22 -0
- data/data/facets/units/dump_yaml.rb +309 -0
- data/data/facets/units/si/base.yaml +36 -0
- data/data/facets/units/si/derived.yaml +133 -0
- data/data/facets/units/si/extra.yaml +107 -0
- data/data/facets/units/standard.yaml +5 -0
- data/data/facets/units/uk.yaml +16 -0
- data/data/facets/units/uk/base.yaml +107 -0
- data/data/facets/units/us.yaml +16 -0
- data/data/facets/units/us/base.yaml +112 -0
- data/data/facets/units/xmethods/cached.yaml +83 -0
- data/data/facets/units/xmethods/mapping.yaml +85 -0
- data/lib/facet/array/join_sentence.rb +1 -0
- data/lib/facet/class/cattr.rb +1 -0
- data/lib/facet/class/cattr_accessor.rb +1 -0
- data/lib/facet/class/cattr_reader.rb +1 -0
- data/lib/facet/class/cattr_writer.rb +1 -0
- data/lib/facet/elementor.rb +1 -0
- data/lib/facet/enumerable/accumulate.rb +1 -0
- data/lib/facet/enumerable/collect_if.rb +1 -0
- data/lib/facet/enumerable/map_if.rb +1 -0
- data/lib/facet/file/self/append.rb +1 -0
- data/lib/facet/file/self/read_binary.rb +1 -0
- data/lib/facet/file/self/write.rb +1 -0
- data/lib/facet/json.rb +1 -0
- data/lib/facet/kernel/__self__.rb +1 -0
- data/lib/facet/kernel/methodname.rb +1 -0
- data/lib/facet/module/attr_query.rb +1 -0
- data/lib/facet/module/attr_validator.rb +1 -0
- data/lib/facet/module/inherit.rb +1 -0
- data/lib/facet/module/let.rb +1 -0
- data/lib/facet/module/mattr.rb +1 -0
- data/lib/facet/module/mattr_accessor.rb +1 -0
- data/lib/facet/module/mattr_reader.rb +1 -0
- data/lib/facet/module/mattr_writer.rb +1 -0
- data/lib/facet/module/singleton_to_module.rb +1 -0
- data/lib/facet/nilclass/op_cmp.rb +1 -0
- data/lib/facet/nilclass/succ.rb +1 -0
- data/lib/facet/recorder.rb +1 -0
- data/lib/facet/xoxo.rb +1 -0
- data/lib/facets/core/array.rb +1 -0
- data/lib/facets/core/array/join_sentence.rb +12 -0
- data/lib/facets/core/class.rb +4 -0
- data/lib/facets/core/{module → class}/cattr.rb +7 -9
- data/lib/facets/core/class/cattr_accessor.rb +2 -0
- data/lib/facets/core/class/cattr_reader.rb +3 -0
- data/lib/facets/core/class/cattr_writer.rb +2 -0
- data/lib/facets/core/dir/self/ls_r.rb +4 -9
- data/lib/facets/core/enumerable.rb +3 -0
- data/lib/facets/core/enumerable/accumulate.rb +25 -0
- data/lib/facets/core/enumerable/collect_if.rb +15 -0
- data/lib/facets/core/enumerable/ew.rb +1 -5
- data/lib/facets/core/enumerable/map_if.rb +3 -0
- data/lib/facets/core/file.rb +3 -0
- data/lib/facets/core/file/self/append.rb +8 -0
- data/lib/facets/core/file/self/create.rb +14 -8
- data/lib/facets/core/file/self/open_as_string.rb +31 -13
- data/lib/facets/core/file/self/read_binary.rb +8 -0
- data/lib/facets/core/file/self/read_list.rb +11 -7
- data/lib/facets/core/file/self/write.rb +8 -0
- data/lib/facets/core/fileutils/wc.rb +4 -9
- data/lib/facets/core/fileutils/which.rb +4 -9
- data/lib/facets/core/kernel.rb +2 -1
- data/lib/facets/core/kernel/__self__.rb +32 -0
- data/lib/facets/core/kernel/as.rb +1 -1
- data/lib/facets/core/kernel/assign_from.rb +3 -3
- data/lib/facets/core/kernel/assign_with.rb +2 -0
- data/lib/facets/core/kernel/me.rb +3 -2
- data/lib/facets/core/kernel/method_name.rb +2 -49
- data/lib/facets/core/kernel/methodname.rb +49 -0
- data/lib/facets/core/module.rb +9 -4
- data/lib/facets/core/module/attr_query.rb +56 -0
- data/lib/facets/core/module/attr_validator.rb +18 -0
- data/lib/facets/core/module/inherit.rb +70 -0
- data/lib/facets/core/module/integrate.rb +1 -1
- data/lib/facets/core/module/let.rb +55 -0
- data/lib/facets/core/module/mattr.rb +180 -0
- data/lib/facets/core/module/{cattr_accessor.rb → mattr_accessor.rb} +0 -0
- data/lib/facets/core/module/{cattr_reader.rb → mattr_reader.rb} +0 -0
- data/lib/facets/core/module/{cattr_writer.rb → mattr_writer.rb} +0 -0
- data/lib/facets/core/module/on_included.rb +3 -1
- data/lib/facets/core/module/singleton_to_module.rb +23 -0
- data/lib/facets/core/nilclass.rb +2 -0
- data/lib/facets/core/string/methodize.rb +4 -3
- data/lib/facets/core/string/modulize.rb +3 -3
- data/lib/facets/more/ansicode.rb +1 -1
- data/lib/facets/more/aspects.rb +1 -1
- data/lib/facets/more/basicobject.rb +67 -22
- data/lib/facets/more/classinherit.rb +2 -2
- data/lib/facets/more/cloneable.rb +1 -1
- data/lib/facets/more/consoleapp.rb +31 -20
- data/lib/facets/more/dictionary.rb +1 -1
- data/lib/facets/more/filelist.rb +2 -10
- data/lib/facets/more/functor.rb +6 -6
- data/lib/facets/more/json.rb +891 -0
- data/lib/facets/more/methodprobe.rb +1 -1
- data/lib/facets/more/multiton.rb +16 -8
- data/lib/facets/more/nilcomparable.rb +31 -49
- data/lib/facets/more/openobject.rb +50 -10
- data/lib/facets/more/recorder.rb +125 -0
- data/lib/facets/more/rtals.rb +199 -4
- data/lib/facets/more/typecast.rb +12 -12
- data/lib/facets/more/units.rb +20 -14
- data/lib/facets/more/xoxo.rb +519 -0
- data/setup.rb +283 -271
- data/test/lib/facets/core/array/test_at_rand.rb +1 -1
- data/test/lib/facets/core/array/test_delete_unless.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values_at.rb +1 -1
- data/test/lib/facets/core/array/test_first.rb +1 -1
- data/test/lib/facets/core/array/test_head.rb +1 -1
- data/test/lib/facets/core/array/test_last_index.rb +1 -1
- data/test/lib/facets/core/array/test_merge.rb +1 -1
- data/test/lib/facets/core/array/test_mid.rb +1 -1
- data/test/lib/facets/core/array/test_middle.rb +1 -1
- data/test/lib/facets/core/array/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/array/test_op_store.rb +1 -1
- data/test/lib/facets/core/array/test_pick.rb +1 -1
- data/test/lib/facets/core/array/test_pos.rb +1 -1
- data/test/lib/facets/core/array/test_pull.rb +1 -1
- data/test/lib/facets/core/array/test_rand_index.rb +1 -1
- data/test/lib/facets/core/array/test_rand_subset.rb +1 -1
- data/test/lib/facets/core/array/test_range.rb +1 -1
- data/test/lib/facets/core/array/test_rotate.rb +1 -1
- data/test/lib/facets/core/array/test_select.rb +1 -1
- data/test/lib/facets/core/array/test_shuffle.rb +1 -1
- data/test/lib/facets/core/array/test_slap.rb +1 -1
- data/test/lib/facets/core/array/test_thru.rb +1 -1
- data/test/lib/facets/core/array/test_to_b.rb +1 -1
- data/test/lib/facets/core/array/test_to_h.rb +1 -1
- data/test/lib/facets/core/array/test_to_hash.rb +1 -1
- data/test/lib/facets/core/binding/self/test_of_caller.rb +1 -1
- data/test/lib/facets/core/binding/test___LINE__.rb +1 -1
- data/test/lib/facets/core/binding/test_call_stack.rb +1 -1
- data/test/lib/facets/core/binding/test_called.rb +1 -1
- data/test/lib/facets/core/binding/test_caller.rb +1 -1
- data/test/lib/facets/core/binding/test_defined.rb +1 -1
- data/test/lib/facets/core/binding/test_eval.rb +1 -1
- data/test/lib/facets/core/binding/test_local_variables.rb +1 -1
- data/test/lib/facets/core/binding/test_method_name.rb +1 -1
- data/test/lib/facets/core/binding/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/binding/test_op_store.rb +1 -1
- data/test/lib/facets/core/binding/test_self.rb +1 -1
- data/test/lib/facets/core/{module/test_cattr_accessor.rb → class/test_cattr.rb} +11 -3
- data/test/lib/facets/core/class/test_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_method_name.rb +1 -1
- data/test/lib/facets/core/class/test_remove_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_unix_path.rb +1 -1
- data/test/lib/facets/core/comparable/test_at_least.rb +1 -1
- data/test/lib/facets/core/comparable/test_clip.rb +1 -1
- data/test/lib/facets/core/comparable/test_cmp.rb +1 -1
- data/test/lib/facets/core/continuation/self/test_create.rb +1 -1
- data/test/lib/facets/core/date/test_days_in_month.rb +1 -1
- data/test/lib/facets/core/date/test_days_of_month.rb +1 -1
- data/test/lib/facets/core/date/test_stamp.rb +1 -1
- data/test/lib/facets/core/date/test_to_date.rb +1 -1
- data/test/lib/facets/core/date/test_to_s.rb +1 -1
- data/test/lib/facets/core/date/test_to_time.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ancestor.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ascend.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_combinations.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_collect_with_index.rb +1 -1
- data/test/lib/facets/core/enumerable/test_commonality.rb +1 -1
- data/test/lib/facets/core/enumerable/test_compact_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_combination.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_slice.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_every.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ew.rb +1 -1
- data/test/lib/facets/core/enumerable/test_filter_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_find_collisions.rb +1 -1
- data/test/lib/facets/core/enumerable/test_frequency.rb +1 -1
- data/test/lib/facets/core/enumerable/test_graph.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_none.rb +1 -1
- data/test/lib/facets/core/enumerable/test_occur.rb +1 -1
- data/test/lib/facets/core/enumerable/test_one.rb +1 -1
- data/test/lib/facets/core/enumerable/test_op_pow.rb +1 -1
- data/test/lib/facets/core/enumerable/test_partition_by.rb +1 -1
- data/test/lib/facets/core/enumerable/test_permute.rb +1 -1
- data/test/lib/facets/core/enumerable/test_probability.rb +1 -1
- data/test/lib/facets/core/enumerable/test_to_h.rb +1 -1
- data/test/lib/facets/core/enumerable/test_uniq_by.rb +1 -1
- data/test/lib/facets/core/file/self/test_create.rb +14 -9
- data/test/lib/facets/core/file/self/test_open_as_string.rb +21 -11
- data/test/lib/facets/core/file/self/test_read_list.rb +11 -8
- data/test/lib/facets/core/file/self/test_sanitize.rb +1 -1
- data/test/lib/facets/core/file/self/test_split_all.rb +1 -1
- data/test/lib/facets/core/float/test_round_at.rb +1 -1
- data/test/lib/facets/core/float/test_round_to.rb +1 -1
- data/test/lib/facets/core/hash/self/test_zipnew.rb +1 -1
- data/test/lib/facets/core/hash/test_alias.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_at.rb +1 -1
- data/test/lib/facets/core/hash/test_collate.rb +1 -1
- data/test/lib/facets/core/hash/test_each.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_index.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_key.rb +1 -1
- data/test/lib/facets/core/hash/test_graph.rb +1 -1
- data/test/lib/facets/core/hash/test_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_inverse.rb +1 -1
- data/test/lib/facets/core/hash/test_keys_to_s.rb +1 -1
- data/test/lib/facets/core/hash/test_keys_to_sym.rb +1 -1
- data/test/lib/facets/core/hash/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/hash/test_op_lshift.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_key.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_pair.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_value.rb +1 -1
- data/test/lib/facets/core/hash/test_replace_each.rb +1 -1
- data/test/lib/facets/core/hash/test_shuffle.rb +1 -1
- data/test/lib/facets/core/hash/test_slice.rb +1 -1
- data/test/lib/facets/core/hash/test_swap.rb +1 -1
- data/test/lib/facets/core/hash/test_swapkey.rb +1 -1
- data/test/lib/facets/core/hash/test_to_h.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +1 -1
- data/test/lib/facets/core/hash/test_traverse.rb +1 -1
- data/test/lib/facets/core/hash/test_update_each.rb +1 -1
- data/test/lib/facets/core/hash/test_update_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_update_values.rb +1 -1
- data/test/lib/facets/core/hash/test_weave.rb +1 -1
- data/test/lib/facets/core/integer/test_factorial.rb +1 -1
- data/test/lib/facets/core/integer/test_multiple.rb +1 -1
- data/test/lib/facets/core/integer/test_ordinal.rb +1 -1
- data/test/lib/facets/core/integer/test_times_collect.rb +1 -1
- data/test/lib/facets/core/kernel/test___class__.rb +1 -1
- data/test/lib/facets/core/kernel/test_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_bug.rb +1 -1
- data/test/lib/facets/core/kernel/test_call_stack.rb +1 -1
- data/test/lib/facets/core/kernel/test_called.rb +1 -1
- data/test/lib/facets/core/kernel/test_constant.rb +1 -1
- data/test/lib/facets/core/kernel/test_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_deep_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_demo.rb +1 -1
- data/test/lib/facets/core/kernel/test_fn.rb +1 -1
- data/test/lib/facets/core/kernel/test_generate_method_name.rb +1 -1
- data/test/lib/facets/core/kernel/test_get_by_id.rb +1 -1
- data/test/lib/facets/core/kernel/test_here.rb +1 -1
- data/test/lib/facets/core/kernel/test_in.rb +1 -1
- data/test/lib/facets/core/kernel/test_maybe.rb +1 -1
- data/test/lib/facets/core/kernel/test_metaclass.rb +1 -1
- data/test/lib/facets/core/kernel/test_method.rb +1 -1
- data/test/lib/facets/core/kernel/{test_method_name.rb → test_methodname.rb} +3 -3
- data/test/lib/facets/core/kernel/test_methods.rb +1 -1
- data/test/lib/facets/core/kernel/test_new.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_class.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_hexid.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_all.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_esc.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_facet.rb +1 -1
- data/test/lib/facets/core/kernel/test_resc.rb +1 -1
- data/test/lib/facets/core/kernel/test_returning.rb +1 -1
- data/test/lib/facets/core/kernel/test_send_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_silently.rb +1 -1
- data/test/lib/facets/core/kernel/test_singleton.rb +1 -1
- data/test/lib/facets/core/kernel/test_superior.rb +1 -1
- data/test/lib/facets/core/kernel/test_supermethod.rb +1 -1
- data/test/lib/facets/core/kernel/test_this.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_b.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_uri.rb +1 -1
- data/test/lib/facets/core/kernel/test_val.rb +1 -1
- data/test/lib/facets/core/kernel/test_with_accessor.rb +1 -1
- data/test/lib/facets/core/matchdata/test_match.rb +1 -1
- data/test/lib/facets/core/matchdata/test_matchtree.rb +1 -1
- data/test/lib/facets/core/module/test_abstract.rb +1 -1
- data/test/lib/facets/core/module/test_alias_module_function.rb +1 -1
- data/test/lib/facets/core/module/test_ancestor.rb +1 -1
- data/test/lib/facets/core/module/test_basename.rb +1 -1
- data/test/lib/facets/core/module/test_by_name.rb +1 -1
- data/test/lib/facets/core/module/test_clone_using.rb +1 -1
- data/test/lib/facets/core/module/test_dirname.rb +1 -1
- data/test/lib/facets/core/module/test_equate_on.rb +1 -1
- data/test/lib/facets/core/module/test_generate_instance_method_name.rb +1 -1
- data/test/lib/facets/core/module/test_include_as.rb +1 -1
- data/test/lib/facets/core/module/test_inherit.rb +58 -0
- data/test/lib/facets/core/module/test_initializer.rb +1 -1
- data/test/lib/facets/core/module/test_instance_methods.rb +1 -1
- data/test/lib/facets/core/module/test_integrate.rb +1 -1
- data/test/lib/facets/core/module/test_let.rb +31 -0
- data/test/lib/facets/core/module/test_mattr.rb +71 -0
- data/test/lib/facets/core/module/test_memoize.rb +1 -1
- data/test/lib/facets/core/module/test_modspace.rb +1 -1
- data/test/lib/facets/core/module/test_namespace.rb +1 -1
- data/test/lib/facets/core/module/test_nesting.rb +1 -1
- data/test/lib/facets/core/module/test_on_included.rb +36 -0
- data/test/lib/facets/core/module/test_redef.rb +1 -1
- data/test/lib/facets/core/module/test_redefine_method.rb +1 -1
- data/test/lib/facets/core/module/test_redirect.rb +1 -1
- data/test/lib/facets/core/module/test_redirect_method.rb +1 -1
- data/test/lib/facets/core/module/test_remove.rb +1 -1
- data/test/lib/facets/core/module/test_rename.rb +1 -1
- data/test/lib/facets/core/module/test_rename_method.rb +1 -1
- data/test/lib/facets/core/module/test_revisal.rb +1 -1
- data/test/lib/facets/core/module/test_shadow_method.rb +1 -1
- data/test/lib/facets/core/module/test_sort_on.rb +1 -1
- data/test/lib/facets/core/module/test_undef.rb +1 -1
- data/test/lib/facets/core/module/test_wrap.rb +1 -1
- data/test/lib/facets/core/module/test_wrap_method.rb +1 -1
- data/test/lib/facets/core/nilclass/{test_to_f.rb → test_blank.rb} +5 -5
- data/test/lib/facets/core/nilclass/test_empty.rb +1 -1
- data/test/lib/facets/core/nilclass/test_include.rb +1 -1
- data/test/lib/facets/core/nilclass/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/nilclass/test_size.rb +1 -1
- data/test/lib/facets/core/nilclass/test_to_h.rb +1 -1
- data/test/lib/facets/core/{float → numeric}/test_approx.rb +4 -3
- data/test/lib/facets/core/numeric/test_ceil_multiple.rb +1 -1
- data/test/lib/facets/core/numeric/test_succ.rb +1 -1
- data/test/lib/facets/core/numeric/test_to_b.rb +1 -1
- data/test/lib/facets/core/ostruct/test___merge__.rb +1 -1
- data/test/lib/facets/core/ostruct/test___update__.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_store.rb +1 -1
- data/test/lib/facets/core/proc/test_compose.rb +1 -1
- data/test/lib/facets/core/proc/test_to_method.rb +1 -1
- data/test/lib/facets/core/range/test_to_r.rb +1 -1
- data/test/lib/facets/core/range/test_to_range.rb +1 -1
- data/test/lib/facets/core/range/test_umbrella.rb +1 -1
- data/test/lib/facets/core/range/test_within.rb +1 -1
- data/test/lib/facets/core/regexp/test_arity.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_re.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_regexp.rb +1 -1
- data/test/lib/facets/core/string/self/test_interpolate.rb +1 -1
- data/test/lib/facets/core/string/self/test_patterns.rb +1 -1
- data/test/lib/facets/core/string/self/test_rand_letter.rb +1 -1
- data/test/lib/facets/core/string/test_align_center.rb +1 -1
- data/test/lib/facets/core/string/test_at_rand.rb +1 -1
- data/test/lib/facets/core/string/test_basename.rb +1 -1
- data/test/lib/facets/core/string/test_blank.rb +1 -1
- data/test/lib/facets/core/string/test_bracket.rb +1 -1
- data/test/lib/facets/core/string/test_camelcase.rb +1 -1
- data/test/lib/facets/core/string/test_camelize.rb +1 -1
- data/test/lib/facets/core/string/test_capitalized.rb +1 -1
- data/test/lib/facets/core/string/test_chars.rb +1 -1
- data/test/lib/facets/core/string/test_cmp.rb +1 -1
- data/test/lib/facets/core/string/test_demodulize.rb +1 -1
- data/test/lib/facets/core/string/test_downcase.rb +1 -1
- data/test/lib/facets/core/string/test_dresner.rb +1 -1
- data/test/lib/facets/core/string/test_each_char.rb +1 -1
- data/test/lib/facets/core/string/test_each_word.rb +1 -1
- data/test/lib/facets/core/string/test_first.rb +1 -1
- data/test/lib/facets/core/string/test_fold.rb +1 -1
- data/test/lib/facets/core/string/test_frequency.rb +1 -1
- data/test/lib/facets/core/string/test_humanize.rb +1 -1
- data/test/lib/facets/core/string/test_indent.rb +1 -1
- data/test/lib/facets/core/string/test_index_all.rb +1 -1
- data/test/lib/facets/core/string/test_last.rb +1 -1
- data/test/lib/facets/core/string/test_line_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_lines.rb +1 -1
- data/test/lib/facets/core/string/test_lowercase.rb +1 -1
- data/test/lib/facets/core/string/test_margin.rb +1 -1
- data/test/lib/facets/core/string/test_methodize.rb +1 -1
- data/test/lib/facets/core/string/test_modulize.rb +1 -1
- data/test/lib/facets/core/string/test_mscan.rb +1 -1
- data/test/lib/facets/core/string/test_natcmp.rb +1 -1
- data/test/lib/facets/core/string/test_nchar.rb +1 -1
- data/test/lib/facets/core/string/test_pathize.rb +1 -1
- data/test/lib/facets/core/string/test_pop.rb +1 -1
- data/test/lib/facets/core/string/test_probability.rb +1 -1
- data/test/lib/facets/core/string/test_push.rb +1 -1
- data/test/lib/facets/core/string/test_quote.rb +1 -1
- data/test/lib/facets/core/string/test_rand_byte.rb +1 -1
- data/test/lib/facets/core/string/test_rand_index.rb +1 -1
- data/test/lib/facets/core/string/test_range.rb +1 -1
- data/test/lib/facets/core/string/test_range_all.rb +1 -1
- data/test/lib/facets/core/string/test_range_of_line.rb +1 -1
- data/test/lib/facets/core/string/test_regesc.rb +1 -1
- data/test/lib/facets/core/string/test_shatter.rb +1 -1
- data/test/lib/facets/core/string/test_shift.rb +1 -1
- data/test/lib/facets/core/string/test_shuffle.rb +1 -1
- data/test/lib/facets/core/string/test_similarity.rb +1 -1
- data/test/lib/facets/core/string/test_singular.rb +1 -1
- data/test/lib/facets/core/string/test_slap.rb +1 -1
- data/test/lib/facets/core/string/test_soundex.rb +1 -1
- data/test/lib/facets/core/string/test_succ.rb +1 -1
- data/test/lib/facets/core/string/test_to_a.rb +1 -1
- data/test/lib/facets/core/string/test_to_arr.rb +1 -1
- data/test/lib/facets/core/string/test_to_b.rb +1 -1
- data/test/lib/facets/core/string/test_to_const.rb +1 -1
- data/test/lib/facets/core/string/test_to_date.rb +1 -1
- data/test/lib/facets/core/string/test_to_proc.rb +1 -1
- data/test/lib/facets/core/string/test_to_re.rb +1 -1
- data/test/lib/facets/core/string/test_to_time.rb +1 -1
- data/test/lib/facets/core/string/test_unix_crypt.rb +1 -1
- data/test/lib/facets/core/string/test_unpack.rb +1 -1
- data/test/lib/facets/core/string/test_unshift.rb +1 -1
- data/test/lib/facets/core/string/test_upcase.rb +1 -1
- data/test/lib/facets/core/string/test_whitespace.rb +1 -1
- data/test/lib/facets/core/string/test_word_filter.rb +1 -1
- data/test/lib/facets/core/string/test_word_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_words.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalized.rb +1 -1
- data/test/lib/facets/core/symbol/test_downcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_not.rb +1 -1
- data/test/lib/facets/core/symbol/test_pad.rb +1 -1
- data/test/lib/facets/core/symbol/test_succ.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_const.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_proc.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_str.rb +1 -1
- data/test/lib/facets/core/symbol/test_underscore.rb +1 -1
- data/test/lib/facets/core/symbol/test_upcase.rb +1 -1
- data/test/lib/facets/core/time/test_change.rb +1 -1
- data/test/lib/facets/core/time/test_elapse.rb +1 -1
- data/test/lib/facets/core/time/test_stamp.rb +1 -1
- data/test/lib/facets/core/time/test_to_date.rb +1 -1
- data/test/lib/facets/core/time/test_to_s.rb +1 -1
- data/test/lib/facets/core/time/test_to_time.rb +1 -1
- data/test/lib/facets/more/test_annotation.rb +1 -1
- data/test/lib/facets/more/test_ansicode.rb +1 -1
- data/test/lib/facets/more/test_association.rb +1 -1
- data/test/lib/facets/more/test_basicobject.rb +58 -0
- data/test/lib/facets/more/test_bbcode.rb +1 -1
- data/test/lib/facets/more/test_bitmask.rb +1 -1
- data/test/lib/facets/more/test_bytes.rb +1 -1
- data/test/lib/facets/more/test_classinherit.rb +1 -1
- data/test/lib/facets/more/test_classmethods.rb +1 -1
- data/test/lib/facets/more/test_coroutine.rb +1 -1
- data/test/lib/facets/more/test_crypt.rb +1 -1
- data/test/lib/facets/more/test_dictionary.rb +1 -1
- data/test/lib/facets/more/test_elementor.rb +48 -0
- data/test/lib/facets/more/test_enumerablepass.rb +1 -1
- data/test/lib/facets/more/test_floatstring.rb +1 -1
- data/test/lib/facets/more/test_functor.rb +1 -1
- data/test/lib/facets/more/test_inheritor.rb +1 -1
- data/test/lib/facets/more/test_interval.rb +1 -1
- data/test/lib/facets/more/test_json.rb +232 -0
- data/test/lib/facets/more/test_lisp.rb +1 -1
- data/test/lib/facets/more/test_lisp_format.rb +1 -1
- data/test/lib/facets/more/test_lrucache.rb +1 -1
- data/test/lib/facets/more/test_mathconstants.rb +1 -1
- data/test/lib/facets/more/test_methodprobe.rb +1 -1
- data/test/lib/facets/more/test_multipliers.rb +1 -1
- data/test/lib/facets/more/test_multiton.rb +1 -1
- data/test/lib/facets/more/test_nackclass.rb +1 -1
- data/test/lib/facets/more/test_nilcomparable.rb +6 -2
- data/test/lib/facets/more/test_openobject.rb +1 -1
- data/test/lib/facets/more/test_overload.rb +1 -1
- data/test/lib/facets/more/test_paramix.rb +1 -1
- data/test/lib/facets/more/test_preinitialize.rb +1 -1
- data/test/lib/facets/more/test_promoteself.rb +1 -1
- data/test/lib/facets/more/test_recorder.rb +44 -0
- data/test/lib/facets/more/test_snapshot.rb +1 -1
- data/test/lib/facets/more/test_statichash.rb +1 -1
- data/test/lib/facets/more/test_syncarray.rb +1 -1
- data/test/lib/facets/more/test_synchash.rb +1 -1
- data/test/lib/facets/more/test_tagiterator.rb +1 -1
- data/test/lib/facets/more/test_timer.rb +1 -1
- data/test/lib/facets/more/test_times.rb +1 -1
- data/test/lib/facets/more/test_tuple.rb +1 -1
- data/test/lib/facets/more/test_typecast.rb +2 -2
- data/test/lib/facets/more/test_uninheritable.rb +1 -1
- data/test/lib/facets/more/test_units.rb +16 -10
- data/test/lib/facets/more/test_xoxo.rb +288 -0
- data/test/lib/facets/more/test_yamlstruct.rb +1 -1
- metadata +92 -25
- data/lib/facet/kernel/instance.rb +0 -1
- data/lib/facet/module/cattr.rb +0 -1
- data/lib/facet/module/cattr_accessor.rb +0 -1
- data/lib/facet/module/cattr_reader.rb +0 -1
- data/lib/facet/module/cattr_writer.rb +0 -1
- data/lib/facets/core/kernel/instance.rb +0 -29
- data/test/FIXTURE/create_file +0 -1
- data/test/FIXTURE/open_as_string_file +0 -1
- data/test/FIXTURE/read_list_file +0 -6
- data/test/lib/facets/core/dir/self/test_ls_r.rb +0 -52
- data/test/lib/facets/core/fileutils/test_wc.rb +0 -68
- data/test/lib/facets/core/fileutils/test_which.rb +0 -61
- data/test/testdir.rb +0 -8
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
-
|
3
|
+
type: import
|
4
|
+
file: si/derived
|
5
|
+
-
|
6
|
+
type: import
|
7
|
+
file: si/extra
|
8
|
+
-
|
9
|
+
type: import
|
10
|
+
file: us/base
|
11
|
+
-
|
12
|
+
type: import
|
13
|
+
file: us/base
|
14
|
+
-
|
15
|
+
type: import
|
16
|
+
file: binary/base
|
17
|
+
-
|
18
|
+
name: XMethods
|
19
|
+
type: service
|
20
|
+
-
|
21
|
+
type: import
|
22
|
+
file: currency/base
|
@@ -0,0 +1,309 @@
|
|
1
|
+
require 'soap/wsdlDriver'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
SI_BASE = [
|
5
|
+
{'type' => 'si', 'name' => 'meter', 'alias' => 'meters', 'abbrev' => 'm'},
|
6
|
+
{'type' => 'si', 'name' => 'gram', 'alias' => 'grams', 'abbrev' => 'g'},
|
7
|
+
{'type' => 'si', 'name' => 'second', 'alias' => 'seconds', 'abbrev' => 's'},
|
8
|
+
{'type' => 'si', 'name' => 'ampere', 'alias' => 'amperes', 'abbrev' => 'A'},
|
9
|
+
{'type' => 'si', 'name' => 'kelvin', 'alias' => 'kelvins', 'abbrev' => 'K'},
|
10
|
+
{'type' => 'si', 'name' => 'mole', 'alias' => 'moles', 'abbrev' => 'mol'},
|
11
|
+
{'type' => 'si', 'name' => 'candela', 'alias' => 'candelas', 'abbrev' => 'cd'},
|
12
|
+
]
|
13
|
+
|
14
|
+
SI_DERIVED = [
|
15
|
+
{'type' => 'import', 'file' => 'si/base'},
|
16
|
+
{'type' => 'si', 'name' => 'radian', 'alias' => 'radians', "abbrev" => 'rad', 'equals' => ''},
|
17
|
+
{'type' => 'si', 'name' => 'steradian', 'alias' => 'steradians', "abbrev" => 'sr', 'equals' => ''},
|
18
|
+
{'type' => 'si', 'name' => 'hertz', "abbrev" => 'Hz', 'equals' => '1/s'},
|
19
|
+
{'type' => 'si', 'name' => 'newton', 'alias' => 'newtons', "abbrev" => 'N', 'equals' => 'kg*m/s**2'},
|
20
|
+
{'type' => 'si', 'name' => 'pascal', 'alias' => 'pascals', "abbrev" => 'Pa', 'equals' => 'N/m**2'},
|
21
|
+
{'type' => 'si', 'name' => 'joule', 'alias' => 'joules', "abbrev" => 'J', 'equals' => 'N*m'},
|
22
|
+
{'type' => 'si', 'name' => 'watt', 'alias' => 'watts', "abbrev" => 'W', 'equals' => 'J/s'},
|
23
|
+
{'type' => 'si', 'name' => 'coulomb', 'alias' => 'coulombs', "abbrev" => 'C', 'equals' => 'A*s'},
|
24
|
+
{'type' => 'si', 'name' => 'volt', 'alias' => 'volts', "abbrev" => 'V', 'equals' => 'W/A'},
|
25
|
+
{'type' => 'si', 'name' => 'farad', 'alias' => 'farads', "abbrev" => 'F', 'equals' => 'C/V'},
|
26
|
+
{'type' => 'si', 'name' => 'ohm', 'alias' => 'ohms', 'equals' => 'V/A'},
|
27
|
+
{'type' => 'si', 'name' => 'siemens', "abbrev" => 'S', 'equals' => 'A/V'},
|
28
|
+
{'type' => 'si', 'name' => 'weber', 'alias' => 'webers', "abbrev" => 'Wb', 'equals' => 'V*s'},
|
29
|
+
{'type' => 'si', 'name' => 'tesla', 'alias' => 'teslas', "abbrev" => 'T', 'equals' => 'Wb/m**2'},
|
30
|
+
{'type' => 'si', 'name' => 'henry', 'alias' => 'henries', "abbrev" => 'H', 'equals' => 'Wb/A'},
|
31
|
+
{'type' => 'si', 'name' => 'lumen', 'alias' => 'lumens', "abbrev" => 'lm', 'equals' => 'cd*sr'},
|
32
|
+
{'type' => 'si', 'name' => 'lux', 'alias' => 'luxen', "abbrev" => 'lx', 'equals' => 'lm/m**2'},
|
33
|
+
{'type' => 'si', 'name' => 'becquerel', 'alias' => 'becquerels', "abbrev" => 'Bq', 'equals' => '1/s'},
|
34
|
+
{'type' => 'si', 'name' => 'gray', 'alias' => 'grays', "abbrev" => 'Gy', 'equals' => 'J/kg'},
|
35
|
+
{'type' => 'si', 'name' => 'sievert', 'alias' => 'sieverts', "abbrev" => 'Sv', 'equals' => 'J/kg'},
|
36
|
+
{'type' => 'si', 'name' => 'katal', 'alias' => 'katals', "abbrev" => 'kat', 'equals' => 'mol/s'},
|
37
|
+
{'type' => 'si', 'name' => 'bar', 'alias' => 'bars', "abbrev" => 'bar', 'equals' => '100.0 kPa'}
|
38
|
+
]
|
39
|
+
|
40
|
+
SI_EXTRA = [
|
41
|
+
{'type' => 'import', 'file' => 'si/derived'},
|
42
|
+
{'type' => 'unit', 'name' => 'minute', 'alias' => 'minutes', "abbrev" => 'min', 'equals' => '60.0 s'},
|
43
|
+
{'type' => 'unit', 'name' => 'hour', 'alias' => 'hours', "abbrev" => 'h', 'equals' => '60.0 min'},
|
44
|
+
{'type' => 'unit', 'name' => 'day', 'alias' => 'days', "abbrev" => 'd', 'equals' => '24.0 h'},
|
45
|
+
{'type' => 'unit', 'name' => 'liter', 'alias' => 'liters', "abbrev" => 'L', 'equals' => 'dm**3'},
|
46
|
+
{'type' => 'unit', 'name' => 'neper', 'alias' => 'nepers', "abbrev" => 'Np', 'equals' => ''},
|
47
|
+
{'type' => 'unit', 'name' => 'electronvolt', 'alias' => 'electronvolts', "abbrev" => 'eV', 'equals' => '1.60218e-19 J'},
|
48
|
+
{'type' => 'unit', 'name' => 'are', 'alias' => 'ares', "abbrev" => 'a', 'equals' => 'dam**2'},
|
49
|
+
{'type' => 'unit', 'name' => 'hectare', 'alias' => 'hectares', "abbrev" => 'ha', 'equals' => 'hm**2'},
|
50
|
+
{'type' => 'unit', 'name' => 'barn', 'alias' => 'barns', 'equals' => '100.0 fm**2'},
|
51
|
+
{'type' => 'unit', 'name' => 'curie', 'alias' => 'curies', "abbrev" => 'Ci', 'equals' => '3.7e10 Bq'},
|
52
|
+
{'type' => 'unit', 'name' => 'roentgen', 'alias' => 'roentgens', "abbrev" => 'R', 'equals' => '2.58e-4 kg'},
|
53
|
+
{'type' => 'unit', 'name' => 'metric_ton', 'alias' => 'metric_tons', "abbrev" => 't', 'equals' => '1000.0 kg'},
|
54
|
+
{'type' => 'unit', 'name' => 'degree', 'alias' => 'degrees', 'equals' => "#{Math::PI / 180} rad"},
|
55
|
+
{'type' => 'unit', 'name' => 'nautical_mile', 'alias' => 'nautical_miles', 'equals' => '1852.0 m'},
|
56
|
+
{'type' => 'unit', 'name' => 'knot', 'alias' => 'knots', 'equals' => 'nautical_mile/h'},
|
57
|
+
{'type' => 'unit', 'name' => 'angstrom', 'alias' => 'angstroms', 'equals' => '100.0 kPa'},
|
58
|
+
{'type' => 'unit', 'name' => 'unified_atomic_mass_unit', 'alias' => 'unified_atomic_mass_units', "abbrev" => 'u', 'equals' => '1.66054e-27 kg'},
|
59
|
+
{'type' => 'unit', 'name' => 'astronomical_unit', 'alias' => 'astronomical_units', "abbrev" => 'ua', 'equals' => '1.49598e11 m'}
|
60
|
+
]
|
61
|
+
|
62
|
+
IMPERIAL_BASE = [
|
63
|
+
{'type' => 'import', 'file' => 'si/base'},
|
64
|
+
{'type' => 'length', 'name' => 'inch', 'alias' => 'inches', "abbrev" => 'in', 'equals' => '2.54 cm'},
|
65
|
+
{'type' => 'length', 'name' => 'foot', 'alias' => 'feet', "abbrev" => 'ft', 'equals' => '12.0 in'},
|
66
|
+
{'type' => 'length', 'name' => 'yard', 'alias' => 'yards', "abbrev" => 'yd', 'equals' => '3.0 ft'},
|
67
|
+
{'type' => 'length', 'name' => 'chain', 'alias' => 'chains', 'equals' => '22.0 yd'},
|
68
|
+
{'type' => 'length', 'name' => 'furlong', 'alias' => 'furlongs', 'equals' => '10.0 chains'},
|
69
|
+
{'type' => 'length', 'name' => 'mile', 'alias' => 'miles', "abbrev" => 'mi', 'equals' => '8.0 furlongs'},
|
70
|
+
{'type' => 'unit', 'name' => 'acre', 'alias' => 'acres', 'equals' => '10 square_chain'},
|
71
|
+
{'type' => 'unit', 'name' => 'fluid_ounce', 'alias' => 'fluid_ounces', "abbrev" => 'fl_oz', 'equals' => '2.8413062e-2 dm**3'},
|
72
|
+
{'type' => 'unit', 'name' => 'gill', 'alias' => 'gills', 'equals' => '5.0 fl_oz'},
|
73
|
+
{'type' => 'unit', 'name' => 'pint', 'alias' => 'pints', "abbrev" => 'pt', 'equals' => '4.0 gills'},
|
74
|
+
{'type' => 'unit', 'name' => 'quart', 'alias' => 'quarts', "abbrev" => 'qt', 'equals' => '2.0 pt'},
|
75
|
+
{'type' => 'unit', 'name' => 'gallon', 'alias' => 'gallons', "abbrev" => 'gal', 'equals' => '4.0 qt'},
|
76
|
+
{'type' => 'unit', 'name' => 'grain', 'alias' => 'grains', "abbrev" => 'gr', 'equals' => '6.479891e-5 kg'},
|
77
|
+
{'type' => 'unit', 'name' => 'ounce', 'alias' => 'ounces', "abbrev" => 'oz', 'equals' => '437.5 gr'},
|
78
|
+
{'type' => 'unit', 'name' => 'pound', 'alias' => 'pounds', "abbrev" => 'lb', 'equals' => '16.0 oz'},
|
79
|
+
{'type' => 'unit', 'name' => 'stone', 'alias' => 'stones', 'equals' => '14.0 lb'},
|
80
|
+
{'type' => 'unit', 'name' => 'hundredweight', 'alias' => 'hundredweights', "abbrev" => 'cwt', 'equals' => '8.0 stone'},
|
81
|
+
{'type' => 'unit', 'name' => 'long_ton', 'alias' => 'long_tons', "abbrev" => 'lt', 'equals' => '20.0 cwt'}
|
82
|
+
]
|
83
|
+
|
84
|
+
US_BASE = [
|
85
|
+
{'type' => 'import', 'file' => 'si/base'},
|
86
|
+
{'type' => 'length', 'name' => 'inch', 'alias' => 'inches', "abbrev" => 'in', 'equals' => '2.54 cm'},
|
87
|
+
{'type' => 'length', 'name' => 'foot', 'alias' => 'feet', "abbrev" => 'ft', 'equals' => '12.0 in'},
|
88
|
+
{'type' => 'length', 'name' => 'yard', 'alias' => 'yards', "abbrev" => 'yd', 'equals' => '3.0 ft'},
|
89
|
+
{'type' => 'length', 'name' => 'furlong', 'alias' => 'furlongs', 'equals' => '220.0 yd'},
|
90
|
+
{'type' => 'length', 'name' => 'mile', 'alias' => 'miles', "abbrev" => 'mi', 'equals' => '8.0 furlongs'},
|
91
|
+
{'type' => 'unit', 'name' => 'acre', 'alias' => 'acres', 'equals' => '4840.0 sq_yd'},
|
92
|
+
{'type' => 'unit', 'name' => 'section', 'alias' => 'sections', 'equals' => '1.0 sq_mi'},
|
93
|
+
{'type' => 'unit', 'name' => 'township', 'alias' => 'townships', 'equals' => '36.0 sections'},
|
94
|
+
{'type' => 'unit', 'name' => 'fluid_ounce', 'alias' => 'fluid_ounces', "abbrev" => 'fl_oz', 'equals' => '2.95735295625e-2 dm**3'},
|
95
|
+
{'type' => 'unit', 'name' => 'gill', 'alias' => 'gills', 'equals' => '4.0 fl_oz'},
|
96
|
+
{'type' => 'unit', 'name' => 'pint', 'alias' => 'pints', "abbrev" => 'pt', 'equals' => '4.0 gills'},
|
97
|
+
{'type' => 'unit', 'name' => 'quart', 'alias' => 'quarts', "abbrev" => 'qt', 'equals' => '2.0 pt'},
|
98
|
+
{'type' => 'unit', 'name' => 'gallon', 'alias' => 'gallons', "abbrev" => 'gal', 'equals' => '4.0 qt'},
|
99
|
+
{'type' => 'unit', 'name' => 'grain', 'alias' => 'grains', "abbrev" => 'gr', 'equals' => '6.479891e-5 kg'},
|
100
|
+
{'type' => 'unit', 'name' => 'ounce', 'alias' => 'ounces', "abbrev" => 'oz', 'equals' => '437.5 gr'},
|
101
|
+
{'type' => 'unit', 'name' => 'pound', 'alias' => 'pounds', "abbrev" => 'lb', 'equals' => '16.0 oz'},
|
102
|
+
{'type' => 'unit', 'name' => 'stone', 'alias' => 'stones', 'equals' => '14.0 lb'},
|
103
|
+
{'type' => 'unit', 'name' => 'hundredweight', 'alias' => 'hundredweights', "abbrev" => 'cwt', 'equals' => '100.0 lb'},
|
104
|
+
{'type' => 'unit', 'name' => 'short_ton', 'alias' => 'short_tons', "abbrev" => 'st', 'equals' => '20.0 cwt'}
|
105
|
+
]
|
106
|
+
|
107
|
+
BINARY_BASE = [
|
108
|
+
{'type' => 'binary', 'name' => 'bit', 'alias' => 'bits', "abbrev" => 'b'},
|
109
|
+
{'type' => 'binary', 'name' => 'byte', 'alias' => 'bytes', "abbrev" => 'B', 'equals' => '8.0 b'}
|
110
|
+
]
|
111
|
+
|
112
|
+
BINARY_EXTRA = [
|
113
|
+
{'type' => 'import', 'file' => 'binary/base'},
|
114
|
+
{'type' => 'unit', 'name' => 'x', "abbrev" => '150 kB/s'}
|
115
|
+
]
|
116
|
+
|
117
|
+
OTHER = [
|
118
|
+
{'type' => 'unit', 'name' => 'percent', 'equals' => '0.01'}
|
119
|
+
]
|
120
|
+
|
121
|
+
XMETHODS = {
|
122
|
+
:mapping => {
|
123
|
+
#'afa' => 'afghanistan', # Returns 0
|
124
|
+
'all' => 'albania',
|
125
|
+
'dzd' => 'algeria',
|
126
|
+
'ars' => 'argentina',
|
127
|
+
'aud' => 'australia',
|
128
|
+
'ats' => 'austria',
|
129
|
+
|
130
|
+
#'bsd' => 'bahamas', # Not supported
|
131
|
+
'bhd' => 'bahrain',
|
132
|
+
'bdt' => 'bangladesh',
|
133
|
+
'bbd' => 'barbados',
|
134
|
+
'bef' => 'belgium',
|
135
|
+
'bmd' => 'bermuda',
|
136
|
+
'brl' => 'brazil',
|
137
|
+
#'bgn' => 'bulgaria', # Not supported
|
138
|
+
|
139
|
+
'cad' => 'canada',
|
140
|
+
'clp' => 'chile',
|
141
|
+
'cny' => 'china',
|
142
|
+
'cop' => 'colombia',
|
143
|
+
'crc' => 'costa rica',
|
144
|
+
'hrk' => 'croatia',
|
145
|
+
'cyp' => 'cyprus',
|
146
|
+
'czk' => 'czech republic',
|
147
|
+
|
148
|
+
'dkk' => 'denmark',
|
149
|
+
'dop' => 'dominican republic',
|
150
|
+
|
151
|
+
'xcd' => 'east caribbean',
|
152
|
+
'egp' => 'egypt',
|
153
|
+
'eek' => 'estonia',
|
154
|
+
'eur' => 'euro',
|
155
|
+
|
156
|
+
#'fjd' => 'fiji', # Returns 0
|
157
|
+
'fim' => 'finland',
|
158
|
+
'frf' => 'france',
|
159
|
+
|
160
|
+
'dem' => 'germany',
|
161
|
+
'grd' => 'greece',
|
162
|
+
|
163
|
+
'hkd' => 'hong kong',
|
164
|
+
'huf' => 'hungary',
|
165
|
+
|
166
|
+
'isk' => 'iceland',
|
167
|
+
'inr' => 'india',
|
168
|
+
'idr' => 'indonesia',
|
169
|
+
#'irr' => 'iran', # Not supported
|
170
|
+
#'iqd' => 'iraq', # Returns 0
|
171
|
+
'iep' => 'ireland',
|
172
|
+
'ils' => 'israel',
|
173
|
+
'itl' => 'italy',
|
174
|
+
|
175
|
+
'jmd' => 'jamaica',
|
176
|
+
'jpy' => 'japan',
|
177
|
+
'jod' => 'jordan',
|
178
|
+
|
179
|
+
'kes' => 'kenya',
|
180
|
+
'krw' => 'korea',
|
181
|
+
'kwd' => 'kuwait',
|
182
|
+
|
183
|
+
'lbp' => 'lebanon',
|
184
|
+
'luf' => 'luxembourg',
|
185
|
+
|
186
|
+
'myr' => 'malaysia',
|
187
|
+
'mtl' => 'malta',
|
188
|
+
'mur' => 'mauritius',
|
189
|
+
'mxn' => 'mexico',
|
190
|
+
'mad' => 'morocco',
|
191
|
+
|
192
|
+
'nlg' => 'netherlands',
|
193
|
+
'nzd' => 'new zealand',
|
194
|
+
'nok' => 'norway',
|
195
|
+
|
196
|
+
'omr' => 'oman',
|
197
|
+
|
198
|
+
'pkr' => 'pakistan',
|
199
|
+
'pen' => 'peru',
|
200
|
+
'php' => 'philippines',
|
201
|
+
'pln' => 'poland',
|
202
|
+
'pte' => 'portugal',
|
203
|
+
|
204
|
+
'qar' => 'qatar',
|
205
|
+
|
206
|
+
'ron' => 'romania',
|
207
|
+
'rub' => 'russia',
|
208
|
+
|
209
|
+
'sar' => 'saudi arabia',
|
210
|
+
'sgd' => 'singapore',
|
211
|
+
'skk' => 'slovakia',
|
212
|
+
'sit' => 'slovenia',
|
213
|
+
'zar' => 'south africa',
|
214
|
+
'esp' => 'spain',
|
215
|
+
'lkr' => 'sri lanka',
|
216
|
+
'sdd' => 'sudan',
|
217
|
+
'sek' => 'sweden',
|
218
|
+
'chf' => 'switzerland',
|
219
|
+
|
220
|
+
'twd' => 'taiwan',
|
221
|
+
'thb' => 'thailand',
|
222
|
+
'ttd' => 'trinidad',
|
223
|
+
'tnd' => 'tunisia',
|
224
|
+
#'try' => 'turkey', # Returns 0
|
225
|
+
|
226
|
+
'aed' => 'united arib emirates', # This is obviously mispelled
|
227
|
+
'gbp' => 'united kingdom',
|
228
|
+
'usd' => 'united states',
|
229
|
+
|
230
|
+
'veb' => 'venezuela',
|
231
|
+
'vnd' => 'vietnam',
|
232
|
+
|
233
|
+
'zmk' => 'zambia'
|
234
|
+
},
|
235
|
+
:base => 'ron'
|
236
|
+
}
|
237
|
+
|
238
|
+
CURRENCIES = ['aed', 'afa', 'all', 'ars', 'ats', 'aud', 'bbd', 'bdt', 'bef', 'bgn', 'bhd', 'bmd', 'brl', 'bsd', 'cad', 'chf', 'clp', 'cny', 'cop', 'crc', 'cyp', 'czk', 'dem', 'dkk', 'dop', 'dzd', 'eek', 'egp', 'esp', 'eur', 'fim', 'fjd', 'frf', 'gbp', 'grd', 'hkd', 'hrk', 'huf', 'idr', 'iep', 'ils', 'inr', 'iqd', 'irr', 'isk', 'itl', 'jmd', 'jod', 'jpy', 'kes', 'krw', 'kwd', 'lbp', 'lkr', 'luf', 'mad', 'mtl', 'mur', 'mxn', 'myr', 'nlg', 'nok', 'nzd', 'omr', 'pen', 'php', 'pkr', 'pln', 'pte', 'qar', 'ron', 'rub', 'sar', 'sdd', 'sek', 'sgd', 'sit', 'skk', 'thb', 'tnd', 'try', 'ttd', 'twd', 'usd', 'veb', 'vnd', 'xcd', 'zar', 'zmk']
|
239
|
+
|
240
|
+
CURRENCY_BASE = CURRENCIES.map { |c| {'type' => 'currency', 'name' => c} }
|
241
|
+
|
242
|
+
driver = SOAP::WSDLDriverFactory.new("http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl").createDriver
|
243
|
+
ron = XMETHODS[:mapping]['ron']
|
244
|
+
|
245
|
+
CACHED_RATES = {}
|
246
|
+
|
247
|
+
CURRENCIES.each do |name|
|
248
|
+
country = XMETHODS[:mapping][name]
|
249
|
+
rate = (driver.getRate(country, ron) rescue nil)
|
250
|
+
puts "#{name} -> #{rate || 'X'}"
|
251
|
+
CACHED_RATES[name] = rate if rate
|
252
|
+
end
|
253
|
+
|
254
|
+
DEFAULT = [
|
255
|
+
{'type' => 'import', 'file' => 'si/derived'},
|
256
|
+
{'type' => 'import', 'file' => 'si/extra'},
|
257
|
+
{'type' => 'import', 'file' => 'us/base'},
|
258
|
+
{'type' => 'import', 'file' => 'us/base'},
|
259
|
+
{'type' => 'import', 'file' => 'binary/base'},
|
260
|
+
{'type' => 'service', 'name' => 'XMethods'},
|
261
|
+
{'type' => 'import', 'file' => 'currency/base'}
|
262
|
+
]
|
263
|
+
|
264
|
+
UK = [
|
265
|
+
{'type' => 'import', 'file' => 'si/derived'},
|
266
|
+
{'type' => 'import', 'file' => 'uk/base'},
|
267
|
+
{'type' => 'import', 'file' => 'binary/base'},
|
268
|
+
{'type' => 'service', 'name' => 'XMethods'},
|
269
|
+
{'type' => 'import', 'file' => 'currency/base'}
|
270
|
+
]
|
271
|
+
|
272
|
+
US = [
|
273
|
+
{'type' => 'import', 'file' => 'si/derived'},
|
274
|
+
{'type' => 'import', 'file' => 'us/base'},
|
275
|
+
{'type' => 'import', 'file' => 'binary/base'},
|
276
|
+
{'type' => 'service', 'name' => 'XMethods'},
|
277
|
+
{'type' => 'import', 'file' => 'currency/base'}
|
278
|
+
]
|
279
|
+
|
280
|
+
CEX = [
|
281
|
+
{'type' => 'service', 'name' => 'CachedXMethods'},
|
282
|
+
{'type' => 'import', 'file' => 'currency/base'}
|
283
|
+
]
|
284
|
+
|
285
|
+
STANDARD_CONVERTORS = [
|
286
|
+
'default',
|
287
|
+
'uk',
|
288
|
+
'us',
|
289
|
+
'cex'
|
290
|
+
]
|
291
|
+
|
292
|
+
File.open('share/units/si/base.yaml', 'w') { |f| f.puts SI_BASE.to_yaml }
|
293
|
+
File.open('share/units/si/derived.yaml', 'w') { |f| f.puts SI_DERIVED.to_yaml }
|
294
|
+
File.open('share/units/si/extra.yaml', 'w') { |f| f.puts SI_EXTRA.to_yaml }
|
295
|
+
File.open('share/units/uk/base.yaml', 'w') { |f| f.puts IMPERIAL_BASE.to_yaml }
|
296
|
+
File.open('share/units/us/base.yaml', 'w') { |f| f.puts US_BASE.to_yaml }
|
297
|
+
File.open('share/units/currency/base.yaml', 'w') { |f| f.puts CURRENCY_BASE.to_yaml }
|
298
|
+
File.open('share/units/binary/base.yaml', 'w') { |f| f.puts BINARY_BASE.to_yaml }
|
299
|
+
File.open('share/units/binary/extra.yaml', 'w') { |f| f.puts BINARY_EXTRA.to_yaml }
|
300
|
+
|
301
|
+
File.open('share/units/xmethods/mapping.yaml', 'w') { |f| f.puts XMETHODS.to_yaml }
|
302
|
+
File.open('share/units/xmethods/cached.yaml', 'w') { |f| f.puts CACHED_RATES.to_yaml }
|
303
|
+
|
304
|
+
File.open('share/units/default.yaml', 'w') { |f| f.puts DEFAULT.to_yaml }
|
305
|
+
File.open('share/units/us.yaml', 'w') { |f| f.puts US.to_yaml }
|
306
|
+
File.open('share/units/uk.yaml', 'w') { |f| f.puts UK.to_yaml }
|
307
|
+
File.open('share/units/cex.yaml', 'w') { |f| f.puts CEX.to_yaml }
|
308
|
+
|
309
|
+
File.open('share/units/standard.yaml', 'w') { |f| f.puts STANDARD_CONVERTORS.to_yaml }
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
-
|
3
|
+
name: meter
|
4
|
+
abbrev: m
|
5
|
+
type: si
|
6
|
+
alias: meters
|
7
|
+
-
|
8
|
+
name: gram
|
9
|
+
abbrev: g
|
10
|
+
type: si
|
11
|
+
alias: grams
|
12
|
+
-
|
13
|
+
name: second
|
14
|
+
abbrev: s
|
15
|
+
type: si
|
16
|
+
alias: seconds
|
17
|
+
-
|
18
|
+
name: ampere
|
19
|
+
abbrev: A
|
20
|
+
type: si
|
21
|
+
alias: amperes
|
22
|
+
-
|
23
|
+
name: kelvin
|
24
|
+
abbrev: K
|
25
|
+
type: si
|
26
|
+
alias: kelvins
|
27
|
+
-
|
28
|
+
name: mole
|
29
|
+
abbrev: mol
|
30
|
+
type: si
|
31
|
+
alias: moles
|
32
|
+
-
|
33
|
+
name: candela
|
34
|
+
abbrev: cd
|
35
|
+
type: si
|
36
|
+
alias: candelas
|
@@ -0,0 +1,133 @@
|
|
1
|
+
---
|
2
|
+
-
|
3
|
+
type: import
|
4
|
+
file: si/base
|
5
|
+
-
|
6
|
+
name: radian
|
7
|
+
abbrev: rad
|
8
|
+
type: si
|
9
|
+
equals: ''
|
10
|
+
alias: radians
|
11
|
+
-
|
12
|
+
name: steradian
|
13
|
+
abbrev: sr
|
14
|
+
type: si
|
15
|
+
equals: ''
|
16
|
+
alias: steradians
|
17
|
+
-
|
18
|
+
name: hertz
|
19
|
+
abbrev: Hz
|
20
|
+
type: si
|
21
|
+
equals: 1/s
|
22
|
+
-
|
23
|
+
name: newton
|
24
|
+
abbrev: N
|
25
|
+
type: si
|
26
|
+
equals: kg*m/s**2
|
27
|
+
alias: newtons
|
28
|
+
-
|
29
|
+
name: pascal
|
30
|
+
abbrev: Pa
|
31
|
+
type: si
|
32
|
+
equals: N/m**2
|
33
|
+
alias: pascals
|
34
|
+
-
|
35
|
+
name: joule
|
36
|
+
abbrev: J
|
37
|
+
type: si
|
38
|
+
equals: N*m
|
39
|
+
alias: joules
|
40
|
+
-
|
41
|
+
name: watt
|
42
|
+
abbrev: W
|
43
|
+
type: si
|
44
|
+
equals: J/s
|
45
|
+
alias: watts
|
46
|
+
-
|
47
|
+
name: coulomb
|
48
|
+
abbrev: C
|
49
|
+
type: si
|
50
|
+
equals: A*s
|
51
|
+
alias: coulombs
|
52
|
+
-
|
53
|
+
name: volt
|
54
|
+
abbrev: V
|
55
|
+
type: si
|
56
|
+
equals: W/A
|
57
|
+
alias: volts
|
58
|
+
-
|
59
|
+
name: farad
|
60
|
+
abbrev: F
|
61
|
+
type: si
|
62
|
+
equals: C/V
|
63
|
+
alias: farads
|
64
|
+
-
|
65
|
+
name: ohm
|
66
|
+
type: si
|
67
|
+
equals: V/A
|
68
|
+
alias: ohms
|
69
|
+
-
|
70
|
+
name: siemens
|
71
|
+
abbrev: S
|
72
|
+
type: si
|
73
|
+
equals: A/V
|
74
|
+
-
|
75
|
+
name: weber
|
76
|
+
abbrev: Wb
|
77
|
+
type: si
|
78
|
+
equals: V*s
|
79
|
+
alias: webers
|
80
|
+
-
|
81
|
+
name: tesla
|
82
|
+
abbrev: T
|
83
|
+
type: si
|
84
|
+
equals: Wb/m**2
|
85
|
+
alias: teslas
|
86
|
+
-
|
87
|
+
name: henry
|
88
|
+
abbrev: H
|
89
|
+
type: si
|
90
|
+
equals: Wb/A
|
91
|
+
alias: henries
|
92
|
+
-
|
93
|
+
name: lumen
|
94
|
+
abbrev: lm
|
95
|
+
type: si
|
96
|
+
equals: cd*sr
|
97
|
+
alias: lumens
|
98
|
+
-
|
99
|
+
name: lux
|
100
|
+
abbrev: lx
|
101
|
+
type: si
|
102
|
+
equals: lm/m**2
|
103
|
+
alias: luxen
|
104
|
+
-
|
105
|
+
name: becquerel
|
106
|
+
abbrev: Bq
|
107
|
+
type: si
|
108
|
+
equals: 1/s
|
109
|
+
alias: becquerels
|
110
|
+
-
|
111
|
+
name: gray
|
112
|
+
abbrev: Gy
|
113
|
+
type: si
|
114
|
+
equals: J/kg
|
115
|
+
alias: grays
|
116
|
+
-
|
117
|
+
name: sievert
|
118
|
+
abbrev: Sv
|
119
|
+
type: si
|
120
|
+
equals: J/kg
|
121
|
+
alias: sieverts
|
122
|
+
-
|
123
|
+
name: katal
|
124
|
+
abbrev: kat
|
125
|
+
type: si
|
126
|
+
equals: mol/s
|
127
|
+
alias: katals
|
128
|
+
-
|
129
|
+
name: bar
|
130
|
+
abbrev: bar
|
131
|
+
type: si
|
132
|
+
equals: 100.0 kPa
|
133
|
+
alias: bars
|